- statoAttuale = digitalRead(switchPin); // read input value and store it in val
- // delay(20) // riduce leffetto bounce
- if (statoAttuale != ultimoStato) { // the button state has changed!
- if (statoAttuale == HIGH) { // check if the button is pressed
+ statoAttuale = digitalRead(switchPin); // Legge lo stato del bottone e lo resistra in val
+ delay(20); // riduce l'effetto bounce
+ if (statoAttuale != ultimoStato) {
+ // verifica due condizioni che devono realizzarsi contemporaneamente
+ if (statoAttuale == HIGH) { // il bottone e' stato premuto