4 Accensione e spegnimanto di un LED utilizzando un pin come input.
6 Utilizzare un jumper per collegare il PIN Input
7 alternativamente a +5 o GND .
10 - http://lab.piffa.net/schemi/led_condizionale.png
14 // Pin 13 has an LED connected on most Arduino boards.
19 // the setup routine runs once when you press reset:
21 // initialize the digital pin as an output.
22 pinMode(led, OUTPUT); // Il PIN e' attivato come output
23 pinMode(input, INPUT); // Il PIN e' attivato come output
26 // the loop routine runs over and over again forever:
28 if (digitalRead(input) == HIGH) { // Verifica se il PIN input e' +5V
29 digitalWrite(led, HIGH);
31 if (digitalRead(input) == LOW) { // Verifica se il PIN input e' 0V
32 digitalWrite(led, LOW);
37 1. Invertire il programma facendo in modo che il led si spenga
38 quando il bottone e' premuto. Considerare come ottenere lo stesso risultato
39 modificando il circuito.
40 2. Modificare il programma per far brillare il led cinque volte al secondo
41 quando il bottone e' premuto.
42 3. Si potrebbe usare un ciclo iterativo while invece che
43 un ciclo condizonale if? Che differenza c'e' tra il ciclo while, if e for?
44 4. Domanda: cosa succede se il jumper input non e' collegato ne al +5 ne al ground?