From 4094b4b648a1ed04bc4091e7e3be2bb6febb30ec Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Thu, 15 Dec 2022 06:18:16 +0100 Subject: [PATCH] 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. --- Digispark_Passkey/Digispark_Passkey.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Digispark_Passkey/Digispark_Passkey.ino b/Digispark_Passkey/Digispark_Passkey.ino index 7797543..19fb490 100644 --- a/Digispark_Passkey/Digispark_Passkey.ino +++ b/Digispark_Passkey/Digispark_Passkey.ino @@ -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); }