This commit is contained in:
James Devine 2017-09-17 23:08:15 +02:00 committed by GitHub
parent 7588dc9ac2
commit 8e3864cb18

View file

@ -83,42 +83,6 @@ void loop(void)
} }
digitalWrite(trigpin, LOW); // Added this line
delayMicroseconds(4); // Added this line
digitalWrite(trigpin, HIGH);
delayMicroseconds(20); // Added this line
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = (duration/2) / 29.1;
Serial.print(millis());
Serial.print(';');
Serial.print(distance);
// if (distance >= 200 || distance <= 0){
// Serial.println("Out of range");
//}
//else {
//Serial.print(distance);
//Serial.println(" cm");
// }
//delay(500);
byte i; byte i;
byte present = 0; byte present = 0;
@ -218,8 +182,48 @@ Ftemp =(Temp * 0.0625);
//delay(1000); //delay(1000);
digitalWrite(trigpin, LOW); // Added this line
delayMicroseconds(4); // Added this line
digitalWrite(trigpin, HIGH);
delayMicroseconds(20); // Added this line
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = (duration/2) / 29.1;
Serial.print(millis());
Serial.print(';');
Serial.print(distance);
// if (distance >= 200 || distance <= 0){
// Serial.println("Out of range");
//}
//else {
//Serial.print(distance);
//Serial.println(" cm");
// }
//delay(500);
//write out all the results in the following format //write out all the results in the following format
// uptime (ms),water level (cm), pH, pH Voltage, water temp (degrees C), air temp (degrees C) // uptime (ms),water level (cm), pH, pH Voltage, water temp (degrees C), air temp (degrees C)
Serial.print(';'); Serial.print(';');
Serial.print(pHValue,2); Serial.print(pHValue,2);
Serial.print(';'); Serial.print(';');