Fixed a bug to set the last press timestamp when releasing the button, not when beeing pressed. Else you never can push the button more then twice when holding down for more then the PAUSE time and you will only get the firt password.

This commit is contained in:
Johannes Findeisen 2022-12-15 06:18:16 +01:00
commit 4094b4b648

View file

@ -71,13 +71,14 @@ void loop() {
// Read button state
if (digitalRead(BUTTON_PIN) == LOW) {
// Button is pressed
last = millis();
count++;
digitalWrite(LED_PIN, HIGH);
// Wait until button is released
while (digitalRead(BUTTON_PIN) == LOW) {
delay(1);
}
// Set the last press timestamp
last = millis();
digitalWrite(LED_PIN, LOW);
}