X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=multitasking%2FBlinkWithoutDelay_6_1_interrupt%2FBlinkWithoutDelay_6_1_interrupt.ino;h=fd77d6c00a9f0b7a9fe7da2da6ff7afb8b4c3433;hb=HEAD;hp=175f70567a420a94be0253115318a7f037ba100e;hpb=3b78d813afb2e27ed29faa261570d2eeb8d5068d;p=sketchbook_andrea diff --git a/multitasking/BlinkWithoutDelay_6_1_interrupt/BlinkWithoutDelay_6_1_interrupt.ino b/multitasking/BlinkWithoutDelay_6_1_interrupt/BlinkWithoutDelay_6_1_interrupt.ino index 175f705..fd77d6c 100644 --- a/multitasking/BlinkWithoutDelay_6_1_interrupt/BlinkWithoutDelay_6_1_interrupt.ino +++ b/multitasking/BlinkWithoutDelay_6_1_interrupt/BlinkWithoutDelay_6_1_interrupt.ino @@ -28,9 +28,9 @@ public: void Update () { // Illumina il ledB secondo un intervallo passato come argomento - if (millis() > previousMillis + interval) { + if (millis() - previousMillis >= interval) { // save the last time you blinked the LED - previousMillis = millis(); + previousMillis += interval; // if the LED is off turn it on and vice-versa: ledState = !ledState ; // Inverti il LED