Skip to content

Commit c87ddd5

Browse files
committed
small changes to the Debounce example
1 parent 97e0f34 commit c87ddd5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

build/shared/examples/02.Digital/Debounce/Debounce.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
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:
3636
int 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;

0 commit comments

Comments
 (0)