//=========================================================================== // Water Level Sensor //=========================================================================== double readDistance(bool display) { double temp = 0; for(int i=0; i<10; i++) { temp += distanceSensor.measureDistanceCm(); delay(20); } temp/=10; if(display) LCD_PRINT("DISTANCE : CM", String(temp)); return temp; } //=========================================================================== // Soil Moisture Sensor //=========================================================================== int readMoisture(bool display) { int temp = 0; for(int i=0; i<10; i++) { temp += map(analogRead(SOIL_SENSOR),550,0,0,100); delay(20); } temp/=10; if(display) LCD_PRINT("Moisture : %", String(temp)); return temp; } //=========================================================================== // Natural Light Sensor //=========================================================================== int readLight(bool display) { int temp = 0; for(int i=0; i<10; i++) { temp += analogRead(LIGHT_SENSOR); delay(20); } temp/=10; if(display) LCD_PRINT("INTENSITY :", String(temp)); return temp; }