]> git.piffa.net Git - sketchbook_andrea/blob - multitasking/blink_0_soluzione/blink_0_soluzione.ino
multitasking
[sketchbook_andrea] / multitasking / blink_0_soluzione / blink_0_soluzione.ino
1 /*
2   Blink
3  Turns on an LED on for one second, then off for one second, repeatedly.
4  
5  This example code is in the public domain.
6  */
7
8 // Pin 13 has an LED connected on most Arduino boards.
9 // give it a name:
10 int ledA = 13; //Primo LED
11 int ledB = 12; //Secondo LED
12
13 // the setup routine runs once when you press reset:
14 void setup() {                
15   // initialize the digital pin as an output.
16   pinMode(ledA, OUTPUT);    
17   pinMode(ledB, OUTPUT);  
18 }
19
20 // the loop routine runs over and over again forever:
21 void loop() {
22   digitalWrite(ledA, HIGH);   // turn the LED on (HIGH is the voltage level)
23   digitalWrite(ledB, HIGH);
24
25   delay(500);               
26   digitalWrite(ledB, LOW);
27
28   delay(500);
29   digitalWrite(ledA, LOW);
30   digitalWrite(ledB, HIGH);
31
32
33   delay(500);               
34   digitalWrite(ledB, LOW);
35
36   delay(500);
37   digitalWrite(ledA, LOW);
38   digitalWrite(ledB, LOW);
39   ;
40 }
41
42 /* Domande
43  1. Aggiungere un secondo LED e farlo brillare ogni 500ms
44  mentre il primo brilla ogni 1000ms
45  */
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60