Just above the line which should turn the pump off.
I'm trying to accomplish the PWM motor running for 10 secs, and the turn off.
if (output_jord < 40 // Fugtighed I plante under 40% start motor
&& output_vand > 40) { // Fugtighed I reservoir over 40% start motor
analogWrite(motor_pwm, 200);
}
else {
analogWrite (motor_pwm, 0);
}
pump_tim_cur_millis = millis();
// If the pump is "ON" and 1000 ms have elapsed, turn off the pump
if (millis() - pump_tim_cur_millis >= 2000) {
analogWrite (motor_pwm, 0);
}