]> git.piffa.net Git - sketchbook_andrea/blobdiff - multitasking/BlinkWithoutDelay_4_argomento/BlinkWithoutDelay_4_argomento.ino
State machine e blinks con millis()
[sketchbook_andrea] / multitasking / BlinkWithoutDelay_4_argomento / BlinkWithoutDelay_4_argomento.ino
index ae2205af4810eb34e9af2359503cd1bfcef8e3e8..e2b28a94d3523ad83f078074dddbc0e7ab50f797 100644 (file)
@@ -34,7 +34,7 @@ void loop()
 void lightLedA (int interval) {
   // Illumina il ledA secondo un intervallo passato come argomento
 
-  if(millis() - previousMillisA > interval) {
+  if (millis() > previousMillisA + interval) {
     // save the last time you blinked the LED 
     previousMillisA = millis();   
 
@@ -52,7 +52,7 @@ void lightLedA (int interval) {
 void lightLedB (int interval) {
   // Illumina il ledB secondo un intervallo passato come argomento
 
-  if(millis() - previousMillisB > interval) {
+  if (millis() > previousMillisB + interval) {
     // save the last time you blinked the LED 
     previousMillisB = millis();