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