Skip to content

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+
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy