read only once

This commit is contained in:
Ollo 2020-11-11 21:54:38 +01:00
parent 04bfaf4d94
commit 060fa80efd

View File

@ -411,8 +411,7 @@ bool readSensors()
rtcLastTemp2 = temp2.getAverage();
/* Use the Ultrasonic sensor to measure waterLevel */
for (int i = 0; i < 5; i++)
{
digitalWrite(SENSOR_SR04_TRIG, LOW);
delayMicroseconds(2);
digitalWrite(SENSOR_SR04_TRIG, HIGH);
@ -421,8 +420,7 @@ bool readSensors()
float duration = pulseIn(SENSOR_SR04_ECHO, HIGH);
waterRawSensor.add((duration * .343) / 2);
Serial << "Distance sensor " << duration << " ms : " << waterRawSensor.getAverage() << " cm" << endl;
delay(20);
}
/* deactivate the sensors */
digitalWrite(OUTPUT_SENSOR, LOW);
return leaveMode1;