Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a69c62e

Browse files
committed
Changed data type to unsigned long
As requested in #5311 to avoid overflow issues.
1 parent e9a277e commit a69c62e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎examples/02.Digital/Debounce/Debounce.ino‎

Lines changed: 5 additions & 2 deletions
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+
unsignedlong lastDebounceTime = 0; // the last time the output pin was toggled
46+
unsignedlong debounceDelay = 50; // the debounce time; increase if the output flickers
4447

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

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /