]> git.piffa.net Git - sketchbook_andrea/blob - oggi/blink_1_variabili/blink_1_variabili.ino
Example
[sketchbook_andrea] / oggi / 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 has an LED connected on most Arduino boards.
15 // give it a name:
16 int led = 13;
17 int breve = 200;  // Variabile richiambile nel corso dell'esecuzione
18 int lunga = 1000;
19
20 // /////////////////
21 // Setup: eseguita una volta sola all'accensione della scheda
22 void setup() {                
23   // initialize the digital pin as an output.
24   pinMode(led, OUTPUT);     
25 }
26
27 // ///////////////
28 // loop: Le istruzioni vengono eseguite all'infinito
29 void loop() {
30   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
31   delay(breve);               // wait for a second
32   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
33   delay(breve);               // wait for a second
34
35   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
36   delay(lunga);               // wait for a second
37   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
38   delay(lunga); 
39 }