X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=basic%2Fbuttons%2Fbutton_state_4_state%2Fbutton_state_4_state.ino;h=d21f27ea37ba1fe57409070c47ba8ac4d9154829;hb=3af536aeadb354f5a63959633f0833b3e53721be;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..d21f27e 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,7 @@ 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 in val 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 +39,10 @@ void loop(){ } +/* Domande: + 1. I due cicli if verificano che due condizioni siano concomitanti: e' possibile + integrarli semplificando il codice? + + */