]> git.piffa.net Git - sketchbook_andrea/blobdiff - basic/buttons/button_1/button_1.ino
Merge branch 'master' of kim:/home/git/sketchbook_andrea
[sketchbook_andrea] / basic / buttons / button_1 / button_1.ino
index 5d840ecec927f23789759c5b3e73d7593b246596..27987bcc3e7e7a62fa3650ca9a6e1fa3823c8707 100644 (file)
@@ -9,7 +9,7 @@
 // Pin 13 has an LED connected on most Arduino boards.
 // give it a name:
 int led = 13;
-int input = 8;
+int input = 2;
 
 // the setup routine runs once when you press reset:
 void setup() {                
@@ -20,15 +20,21 @@ void setup() {
 
 // the loop routine runs over and over again forever:
 void loop() {
-  if (digitalRead(input) == HIGH) { // Verifica se il PIN input e' +5v
+  if (digitalRead(input) == HIGH) { // Verifica se il PIN input e' +5V
     digitalWrite(led, HIGH);
   } 
-  else { // Alterativa: se non e' +5v
+  if (digitalRead(input) == LOW) { // Verifica se il PIN input e' 0V
     digitalWrite(led, LOW);
   }
 }
 
+// Modifiche: 
+// 1. invertire il programma facendo in modo che il led si spenga
+// quando il bottone e' premuto. Consoderare come ottenere lo stesso risultato
+// modificando il circuito.
+// 2. Modificare il programma per far brillare il led cinque volte al secondo
+// quando il bottone e' premuto.
 
-// Funzioni create dall'utente:
+// Domanda: cosa succede se il jumper input non e' collegato ne al +5 ne al gound?