]> git.piffa.net Git - sketchbook_andrea/blob - basic/blinks/blink_5_2_leds/blink_5_2_leds.ino
errata blink 2 led
[sketchbook_andrea] / basic / blinks / blink_5_2_leds / blink_5_2_leds.ino
1 /*
2   Blink v5
3  
4  Accensione e spegnimanto di 2 LED.
5  Nel circuito oltre al LED montato direttamente sul pin 13
6  viene aggiunto un altro LED pilotato dal PIN 12.
7  
8  Ricordarsi di usare una resistenza da ~320ohms per il secondo LED.
9  Resistenza = (Voltaggio_Arduino - Forward_voltage_LED) / (ampere utilizzati)
10  R = (5v-1.8v) / 0.010a 
11  R =320ohms
12  
13  This example code is in the public domain.
14  */
15
16 // Pin 13 has an LED connected on most Arduino boards.
17 // give it a name:
18 int led = 13;
19 int red = 12; // Definiamo un altro led
20 int breve = 200;  // Variabile richiambile nel corso dell'esecuzione
21 int lunga = 1000;
22
23 // the setup routine runs once when you press reset:
24 void setup() {                
25   // initialize the digital pin as an output.
26   pinMode(led, OUTPUT); // Abilitaiamo entrambi i LED     
27   pinMode(red, OUTPUT);
28 }
29
30 // the loop routine runs over and over again forever:
31 void loop() {
32   digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
33   delay(breve);               // wait for a second
34   digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
35   delay(breve);               // wait for a second
36
37   digitalWrite(red, HIGH);   // turn the LED on (HIGH is the voltage level)
38   delay(lunga);               // wait for a second
39   digitalWrite(red, LOW);    // turn the LED off by making the voltage LOW
40   delay(lunga); 
41 }
42
43