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