File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
build/shared/examples/02.Digital/Debounce Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 2222 modified 28 Dec 2012
2323 by Mike Walters
2424
25- This example code is in the public domain.
25+ This example code is in the public domain.
2626
2727 http://www.arduino.cc/en/Tutorial/Debounce
2828 */
2929
3030// constants won't change. They're used here to
3131// set pin numbers:
32- const int buttonPin = 2 ; // the number of the pushbutton pin
33- const int ledPin = 13 ; // the number of the LED pin
32+ const int buttonPin = 2 ; // the number of the pushbutton pin
33+ const int ledPin = 13 ; // the number of the LED pin
3434
3535// Variables will change:
3636int ledState = HIGH; // the current state of the output pin
@@ -75,13 +75,13 @@ void loop() {
7575 // only toggle the LED if the new button state is HIGH
7676 if (buttonState == HIGH) {
7777 ledState = !ledState;
78-
79- // set the LED:
80- digitalWrite (ledPin, ledState);
8178 }
8279 }
8380 }
8481
82+ // set the LED:
83+ digitalWrite (ledPin, ledState);
84+
8585 // save the reading. Next time through the loop,
8686 // it'll be the lastButtonState:
8787 lastButtonState = reading;
You can’t perform that action at this time.
0 commit comments