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:
parent
3da4b46843
commit
4094b4b648
1 changed files with 2 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue