mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-05 13:16:13 +03:00
small changes to the Debounce example
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
modified 28 Dec 2012
|
modified 28 Dec 2012
|
||||||
by Mike Walters
|
by Mike Walters
|
||||||
|
|
||||||
This example code is in the public domain.
|
This example code is in the public domain.
|
||||||
|
|
||||||
http://www.arduino.cc/en/Tutorial/Debounce
|
http://www.arduino.cc/en/Tutorial/Debounce
|
||||||
*/
|
*/
|
||||||
@@ -75,12 +75,12 @@ void loop() {
|
|||||||
// only toggle the LED if the new button state is HIGH
|
// only toggle the LED if the new button state is HIGH
|
||||||
if (buttonState == HIGH) {
|
if (buttonState == HIGH) {
|
||||||
ledState = !ledState;
|
ledState = !ledState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set the LED:
|
// set the LED:
|
||||||
digitalWrite(ledPin, ledState);
|
digitalWrite(ledPin, ledState);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// save the reading. Next time through the loop,
|
// save the reading. Next time through the loop,
|
||||||
// it'll be the lastButtonState:
|
// it'll be the lastButtonState:
|
||||||
|
Reference in New Issue
Block a user