From c87ddd567df1891a6bbcaaf6c6ae721d3d860b00 Mon Sep 17 00:00:00 2001 From: Fede85 Date: Tue, 16 Apr 2013 16:50:23 +0200 Subject: [PATCH] small changes to the Debounce example --- .../shared/examples/02.Digital/Debounce/Debounce.ino | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/shared/examples/02.Digital/Debounce/Debounce.ino b/build/shared/examples/02.Digital/Debounce/Debounce.ino index 3ead18503..da3aa29d9 100644 --- a/build/shared/examples/02.Digital/Debounce/Debounce.ino +++ b/build/shared/examples/02.Digital/Debounce/Debounce.ino @@ -22,15 +22,15 @@ modified 28 Dec 2012 by Mike Walters -This example code is in the public domain. + This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Debounce */ // constants won't change. They're used here to // set pin numbers: -const int buttonPin = 2; // the number of the pushbutton pin -const int ledPin = 13; // the number of the LED pin +const int buttonPin = 2; // the number of the pushbutton pin +const int ledPin = 13; // the number of the LED pin // Variables will change: int ledState = HIGH; // the current state of the output pin @@ -75,13 +75,13 @@ void loop() { // only toggle the LED if the new button state is HIGH if (buttonState == HIGH) { ledState = !ledState; - - // set the LED: - digitalWrite(ledPin, ledState); } } } + // set the LED: + digitalWrite(ledPin, ledState); + // save the reading. Next time through the loop, // it'll be the lastButtonState: lastButtonState = reading;