]> git.piffa.net Git - sketchbook_andrea/blobdiff - basic/blinks/blink_3_ciclo_while/blink_3_ciclo_while.ino
PWM
[sketchbook_andrea] / basic / blinks / blink_3_ciclo_while / blink_3_ciclo_while.ino
index 9fcbf8c65fb3180ddbe7a7cb1a065d82ec88dd86..ceb3cfee074051e40cd471c1d1a68fef55f4302b 100644 (file)
@@ -1,7 +1,7 @@
 /*
   Blink v3
- Now with 2 variables and an extra LED (remember a ~320 ohms resistor).
Turns on an LED on for one second, then off for one second, repeatedly.
+ Accensione e spegnimanto di un LED utilizzando un ciclo
iterativo while per comandare il lampeggio.
  
  This example code is in the public domain.
  */
@@ -11,7 +11,6 @@
 int led = 13;
 int breve = 200;  // Variabile richiambile nel corso dell'esecuzione
 int lunga = 1000;
-int iterator = 0; // Defniamo un variabile per controllare un ciclo iterativo
 
 // the setup routine runs once when you press reset:
 void setup() {                
@@ -21,13 +20,13 @@ void setup() {
 
 // the loop routine runs over and over again forever:
 void loop() {
+  int iterator = 0; // Defniamo un variabile per controllare un ciclo iterativo
   while (iterator <10) {
-      rapido(); // accende e spegne rapidamente il LED
-      iterator = iterator +1 ; // incrementa l'iteratore
-      // iterator++ ; // equivalente
+    rapido(); // accende e spegne rapidamente il LED
+    iterator = iterator + 1 ; // incrementa l'iteratore
+    // iterator++ ; // equivalente
   }
   lento();  // accende e spegne lentamente il LED
-  // Domanda: a quanto equivale iterator ora?
 }
 
 // Funzioni create dall'utente:
@@ -53,3 +52,5 @@ void lento() {
 }
 
 
+
+