]> git.piffa.net Git - sketchbook_andrea/blobdiff - oggi/blink_0/blink_0.ino
1st day clean up oggi
[sketchbook_andrea] / oggi / blink_0 / blink_0.ino
index 96f69215038c3e9abc763349a967bf93181cd109..f26f96d7fa5255e6740cce52b38ae15ad3f8fc34 100644 (file)
@@ -1,31 +1,31 @@
+// 1. ////////////
+// Commento iniziale multi linea
 /*
-  Blink
- Turns on an LED on for one second, then off for one second, repeatedly.
- This example code is in the public domain.
- */
+  Blink 
 
-// Pin 13 has an LED connected on most Arduino boards.
-// give it a name:
-int led = 13;
+  Accensione e spegnimanto di un LED utilizzando variabili
+  per impostare la velocita' del lampeggio.
+  
+ */
+// 2. //////////////
+// Dichiarazione variabili
+// 
+int led = 13; // Il LED onboard corrisponde al PIN 13
+              // Ha una resistenza premontata
 
-// the setup routine runs once when you press reset:
+// 3. /////////////////
+// Setup: eseguita una volta sola all'accensione della scheda
 void setup() {                
-  // initialize the digital pin as an output.
-  pinMode(led, OUTPUT);     
+  pinMode(led, OUTPUT); // Abilita il PIN del LED come OUTPUT in modo che
+                        // possa essere acceso    
 }
 
-// the loop routine runs over and over again forever:
+// 4. ///////////////
+// loop: Le istruzioni vengono eseguite all'infinito
 void loop() {
-  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
-  delay(1000);               // wait for a second
-  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
-  delay(1000);               // wait for a second
+  digitalWrite(led, HIGH);  // Mette il PIN del LED in stato acceso
+  delay(1000);              // Aspetta un secondo (mille millisecondi)
+  digitalWrite(led, LOW);   // Mette il PIN del LED in stato spento
+  delay(500);               // Aspetta mezzo secondo
 }
-
-/* Domande
- 1. Aggiungere un secondo LED e farlo brillare ogni 500ms
- mentre il primo brilla ogni 1000ms
- 2. Cosa succederebbe se dovessi anche leggere un input da un sensore / bottone?
- */
-