From 4d28ea8bcd61c5f3f1e641b82c43441ac666eac6 Mon Sep 17 00:00:00 2001 From: agdl Date: Tue, 30 Aug 2016 17:05:20 +0200 Subject: [PATCH] Changed data type to unsigned long As requested in #5311 to avoid overflow issues. --- build/shared/examples/02.Digital/Debounce/Debounce.ino | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/shared/examples/02.Digital/Debounce/Debounce.ino b/build/shared/examples/02.Digital/Debounce/Debounce.ino index 9108b429e..6b428ce4f 100644 --- a/build/shared/examples/02.Digital/Debounce/Debounce.ino +++ b/build/shared/examples/02.Digital/Debounce/Debounce.ino @@ -21,6 +21,9 @@ by Limor Fried modified 28 Dec 2012 by Mike Walters + modified 30 Aug 2016 + by Arturo Guadalupi + This example code is in the public domain. @@ -39,8 +42,8 @@ int lastButtonState = LOW; // the previous reading from the input pin // the following variables are long's because the time, measured in miliseconds, // will quickly become a bigger number than can be stored in an int. -long lastDebounceTime = 0; // the last time the output pin was toggled -long debounceDelay = 50; // the debounce time; increase if the output flickers +unsigned long lastDebounceTime = 0; // the last time the output pin was toggled +unsigned long debounceDelay = 50; // the debounce time; increase if the output flickers void setup() { pinMode(buttonPin, INPUT);