Auto Hand Sanitizer Dispenser - Code Help

    if (pumpState == HIGH) {    >>>>>>>>>>// changes to LOW
      digitalWrite(DCwater_pump, HIGH);
      Serial.println("DC Pump is ON Now!!");
      delay(3000); //3000ms = 3 seconds, change this according to your needs.
      digitalWrite(DCwater_pump, LOW);
      Serial.println("DC Pump is OFF Now!!");
    }
    delay(50);
  }

  lastPumpState = pumpState;
}

critycal_:

critycal_:
Let me know if it worked for you.

his is very useful ...
I changed the code from high to low and succeeded for 3 seconds automatically stopping to keep the detected hand... thank you