X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=oggi%2Fblink_0%2Fblink_0.ino;h=f26f96d7fa5255e6740cce52b38ae15ad3f8fc34;hb=22e41500749cb15583e70d04aa6088196d77da06;hp=96f69215038c3e9abc763349a967bf93181cd109;hpb=fa958474bcffcf0cfc45a620e2fb2c611c44d18f;p=sketchbook_andrea diff --git a/oggi/blink_0/blink_0.ino b/oggi/blink_0/blink_0.ino index 96f6921..f26f96d 100644 --- a/oggi/blink_0/blink_0.ino +++ b/oggi/blink_0/blink_0.ino @@ -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? - */ -