Reading sensors by frequency

This commit is contained in:
c3ma
2021-07-21 21:23:58 +02:00
parent 2d167c7393
commit d043d873cc
5 changed files with 82 additions and 183 deletions
+6 -8
View File
@@ -34,6 +34,7 @@
#include <Wire.h>
#include <VL53L0X.h>
/******************************************************************************
* DEFINES
******************************************************************************/
@@ -260,19 +261,16 @@ void readOneWireSensors()
void readPowerSwitchedSensors()
{
digitalWrite(OUTPUT_ENABLE_SENSOR, HIGH);
delay(500);
delay(50);
for (int i = 0; i < MAX_PLANTS; i++)
{
mPlants[i].clearMoisture();
mPlants[i].startMoistureMeasurement();
}
for (int readCnt = 0; readCnt < AMOUNT_SENOR_QUERYS; readCnt++)
delay(MOISTURE_MEASUREMENT_DURATION);
for (int i = 0; i < MAX_PLANTS; i++)
{
for (int i = 0; i < MAX_PLANTS; i++)
{
mPlants[i].addSenseValue();
}
delay(20);
mPlants[i].stopMoistureMeasurement();
}
waterRawSensor.clear();