]> git.piffa.net Git - sketchbook_andrea/blobdiff - advanced_projects/state_machine/semaforo_rgb/semaforo_rgb.ino
Re order
[sketchbook_andrea] / advanced_projects / state_machine / semaforo_rgb / semaforo_rgb.ino
index 3260dbb03c76c74d4d464f1428eed5b5b2b76e94..5d86aa95778c48f47bf4a858b90fa03bb3f1db35 100644 (file)
@@ -8,9 +8,10 @@ Version: singolo semaforo + millis + memoria giallo
 
    Uno stimolo esterno rappresentato dalla pressione di un bottone
    causa il passaggio di stato.
+   Il semaforo resta verde fino a quando non riceve lo stimolo
+   (es passaggio pedonale).
 
    Implementata con millis() invece che con delay(),
-   sono stati aggiuntu due stati per meglio gestire lo stato yellow.
 
    */
 
@@ -18,6 +19,8 @@ Version: singolo semaforo + millis + memoria giallo
 const byte input = 2; // PIN del bottone
 int pausa = 3000;
 long timer ;
+boolean wait = 0; // Memoria bottone
+
 enum states_available { // Stati della FMS
     green,         // Statico
     yellow,            // Statico
@@ -25,7 +28,6 @@ enum states_available { // Stati della FMS
 };
 
 states_available state  ;
-boolean wait = 0;
 
 
 void setup() {
@@ -34,8 +36,7 @@ void setup() {
     timer = millis();
 }
 
-RGBLed led(11, 10, 9); //Istanziamo un oggetto led facente parte
-// della classe RGBLed
+RGBLed led(11, 10, 9); 
 
 void loop() {
     switch (state) {