4 Due LEDs con funzioni che accettano argomenti:
5 gli argomenti permettono di modificar il comportamento
10 // Pin 13 has an LED connected on most Arduino boards.
17 // the setup routine runs once when you press reset:
19 // initialize the digital pin as an output.
24 // the loop routine runs over and over again forever:
33 void lightRed(int length) { // Argomento
34 digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
35 delay(length); // wait for a second
36 digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
40 void lightGreen(int length) {
41 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
42 delay(length); // wait for a second
43 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
44 delay(length); // wait for a second
47 // Test: creare una funzione generica che permetta di accendere
48 // qualunque LED per un periodo di tempo impostabile
50 // Suggerimento: quanti parametri deve accettare?