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 22
22
modified 28 Dec 2012
23
23
by Mike Walters
24
24
25
- This example code is in the public domain.
25
+ This example code is in the public domain.
26
26
27
27
http://www.arduino.cc/en/Tutorial/Debounce
28
28
*/
29
29
30
30
// constants won't change. They're used here to
31
31
// 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
34
34
35
35
// Variables will change:
36
36
int ledState = HIGH; // the current state of the output pin
@@ -75,13 +75,13 @@ void loop() {
75
75
// only toggle the LED if the new button state is HIGH
76
76
if (buttonState == HIGH) {
77
77
ledState = !ledState;
78
-
79
- // set the LED:
80
- digitalWrite (ledPin, ledState);
81
78
}
82
79
}
83
80
}
84
81
82
+ // set the LED:
83
+ digitalWrite (ledPin, ledState);
84
+
85
85
// save the reading. Next time through the loop,
86
86
// it'll be the lastButtonState:
87
87
lastButtonState = reading;
You can’t perform that action at this time.
0 commit comments