Skip to content

Commit 4d28ea8

Browse files
committed
Changed data type to unsigned long
As requested in #5311 to avoid overflow issues.
1 parent 84ede60 commit 4d28ea8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
by Limor Fried
2222
modified 28 Dec 2012
2323
by Mike Walters
24+
modified 30 Aug 2016
25+
by Arturo Guadalupi
26+
2427
2528
This example code is in the public domain.
2629
@@ -39,8 +42,8 @@ int lastButtonState = LOW; // the previous reading from the input pin
3942

4043
// the following variables are long's because the time, measured in miliseconds,
4144
// will quickly become a bigger number than can be stored in an int.
42-
long lastDebounceTime = 0; // the last time the output pin was toggled
43-
long debounceDelay = 50; // the debounce time; increase if the output flickers
45+
unsigned long lastDebounceTime = 0; // the last time the output pin was toggled
46+
unsigned long debounceDelay = 50; // the debounce time; increase if the output flickers
4447

4548
void setup() {
4649
pinMode(buttonPin, INPUT);

0 commit comments

Comments
 (0)