]> git.piffa.net Git - sketchbook_andrea/blobdiff - multitasking/BlinkWithoutDelay_7_struct/BlinkWithoutDelay_7_struct.ino
State machine e blinks con millis()
[sketchbook_andrea] / multitasking / BlinkWithoutDelay_7_struct / BlinkWithoutDelay_7_struct.ino
index 61a53b5b587dfa93160f11f616e5d62f89d93745..e72666285569423af9762ee8e6c6b2cc2966c32c 100644 (file)
@@ -37,7 +37,7 @@ void loop()
 struct blinkLed lightLed(struct blinkLed temp) { // dataType tipo_di_struct nome_funzione(argomenti)
   // Illumina il ledA secondo un intervallo passato come argomento
 
-  if(millis() - temp.previousMillis > temp.interval) { // gli elementi dello struct sono accessibili tramite l'operatore [punto]
+  if (millis() > temp.previousMillis + temp.interval) { // gli elementi dello struct sono accessibili tramite l'operatore [punto]
     // save the last time you blinked the LED 
     temp.previousMillis = millis();