X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=basic%2Fbuttons%2Fbutton_state_4_state%2Fbutton_state_4_state.ino;h=30a330bf05eb198e6aae98a105809884771959c2;hb=2833f00daaa67fa16122dc20873a1f00a346abf8;hp=a6a4e05e504198c8b1028fee93041107e7cbeab1;hpb=e50f2cf8e7402ea56cd01835be9f88c53876bfd1;p=sketchbook_andrea diff --git a/basic/buttons/button_state_4_state/button_state_4_state.ino b/basic/buttons/button_state_4_state/button_state_4_state.ino index a6a4e05..30a330b 100644 --- a/basic/buttons/button_state_4_state/button_state_4_state.ino +++ b/basic/buttons/button_state_4_state/button_state_4_state.ino @@ -20,7 +20,8 @@ void setup() { } void loop(){ - statoAttuale = digitalRead(buttonPin); // Legge lo stato del bottone e lo resistra in val + statoAttuale = digitalRead(buttonPin); // Legge lo stato del bottone e + // lo registra nella variabile delay(20); // riduce l'effetto bounce if (statoAttuale != ultimoStato) { // lo stato del bottone e' cambiato if (statoAttuale == HIGH) { // il bottone e' stato premuto @@ -39,5 +40,10 @@ void loop(){ } +/* Domande: + 1. I due cicli if verificano che due condizioni siano concomitanti: e' possibile + integrarli semplificando il codice? + + */