]> git.piffa.net Git - sketchbook_andrea/blob - basic/blinks/blink_1_variabili/blink_1_variabili.ino
multi cleanup
[sketchbook_andrea] / basic / blinks / blink_1_variabili / blink_1_variabili.ino
1 // ////////////
2 // Commento iniziale
3 /*
4   Blink v1
5
6   Accensione e spegnimanto di un LED utilizzando variabili
7   per impostare la velocita' del lampeggio.
8   
9  */
10  
11 // //////////////
12 // Dichiarazione variabili
13
14 // Pin 13 ha un LED preconfigurato su molte schede Arduino
15 int led = 13;
16 int breve = 200;  // Variabile richiambile nel corso dell'esecuzione
17 int lunga = 1000;
18
19 // /////////////////
20 // Setup: eseguita una volta sola all'accensione della scheda
21 void setup() {                
22   // Inizializziamo il PIN 13 come OUTPUT
23   pinMode(led, OUTPUT);     
24 }
25
26 // ///////////////
27 // loop: Le istruzioni vengono eseguite all'infinito
28 void loop() {
29   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
30   delay(breve);               // wait for a second
31   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
32   delay(breve);               // wait for a second
33
34   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
35   delay(lunga);               // wait for a second
36   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
37   delay(lunga); 
38 }