]> git.piffa.net Git - sketchbook_andrea/blobdiff - multitasking/BlinkWithoutDelay_1/BlinkWithoutDelay_1.ino
Multitasking
[sketchbook_andrea] / multitasking / BlinkWithoutDelay_1 / BlinkWithoutDelay_1.ino
index b7a04a9641948e0a960721d9dbcabc8125fe5e79..408fd16b7ec1d672b193c551478e7deb714afec4 100644 (file)
@@ -56,9 +56,11 @@ void loop()
   // the LED is bigger than the interval at which you want to 
   // blink the LED.
  
-  if (millis() > previousMillis + interval) {
+  if (millis() >= previousMillis + interval) {
     // Aggiorniamo il contatore previousMillis
-    previousMillis = millis();   
+    previousMillis += interval ; 
+    // previousMillis = millis(); // 3) Cosa succederebbe se fosse
+    // passato piu' di 1ms dall'evento all'azione?
 
     // if the LED is off turn it on and vice-versa:
     if (ledState == LOW)
@@ -79,4 +81,10 @@ void loop()
       dovranno aggiungere.
    2. E' ora agevole cambiare gli intervalli dei due LED? 
       Modificare gli intervalli dei due led (es 500ms - 320ms)
+
+
+
+   Risposta
+   3. Si sarebbe introdotto uno slip (ritardo) nei tempi dello sketch
+
  */