   if (!waterPumpIsOn && waterLevelStatus == "OK" && moistureThreshold > moistureSensorVal) {
     prevWatering = millis();
     waterPumpIsOn = true;
+    digitalWrite(WaterPump, HIGH);
     Console.println("Watering started");
   }
 }

}

void readWaterLevelSensor() {
  int val = analogRead(waterSensorPin);
  waterLevelVal = map(val, waterMinVal, waterMaxVal, 0, 100);
  
  if (val < waterLevelThreshold) {
   waterLevelStatus = "LOW";
  } else {
   waterLevelStatus = "OK";

void waterPlantStops(unsigned long currentMillis) {
    if (waterPumpIsOn && currentMillis >= prevWatering + wateringSeconds) {
    waterPumpIsOn = false;
    digitalWrite(WaterPump, LOW);
    Console.println("Watering stopped");    
  } else if (waterPumpIsOn && moistureThreshold < moistureSensorVal) {
    waterPumpIsOn = false;
    digitalWrite(WaterPump, LOW);
    Console.println("Watering stopped");
  } else if (waterPumpIsOn && waterLevelStatus == "LOW") {
    waterPumpIsOn = false;
    digitalWrite(WaterPump, LOW);
    Console.println("Watering stopped");
  }  
}
