X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=basic%2Fbuttons%2Fbutton_presses_counter_AND_4%2Fbutton_presses_counter_AND_4.ino;h=dac48cb93faeba7be4a071cee38123c0ae1cb400;hb=d19cffa69bc2d538de8b73f854f5c3163e231f21;hp=20d15d0f6c9d1868bc89c913a8c719e83ba4bfd8;hpb=0807dd2a57e859d7fc246d8eb02692ea4d0da248;p=sketchbook_andrea diff --git a/basic/buttons/button_presses_counter_AND_4/button_presses_counter_AND_4.ino b/basic/buttons/button_presses_counter_AND_4/button_presses_counter_AND_4.ino index 20d15d0..dac48cb 100644 --- a/basic/buttons/button_presses_counter_AND_4/button_presses_counter_AND_4.ino +++ b/basic/buttons/button_presses_counter_AND_4/button_presses_counter_AND_4.ino @@ -8,7 +8,7 @@ int ultimoStato; // variable to hold the last button state int buttonPresses = 0; // Counter for the button void setup() { - pinMode(switchPin, INPUT_PULLUP); // Set the switch pin as input + pinMode(switchPin, INPUT); // Set the switch pin as input Serial.begin(9600); // Set up serial communication at 9600bps ultimoStato = digitalRead(switchPin); // read the initial state @@ -17,7 +17,7 @@ void setup() { void loop(){ statoAttuale = digitalRead(switchPin); // read input value and store it in val - delay(100); // Debounce, sort of... + delay(20); // Debounce, sort of... if ((statoAttuale != ultimoStato) && (statoAttuale == HIGH)) { // check if the button is pressed buttonPresses++ ; Serial.print("Button has been pressed ");