3 Now with 2 variables and an extra LED (remember a ~320 ohms resistor).
4 Turns on an LED on for one second, then off for one second, repeatedly.
6 This example code is in the public domain.
9 // 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.
22 pinMode(button, INPUT);
25 // the loop routine runs over and over again forever:
27 if (digitalRead(button) == HIGH) { // HIGH sta per +5v
30 if (digitalRead(button) == LOW) { // LOW sta per 0v
35 void lightRed(int length) { // Argomento
36 digitalWrite(red, HIGH); // turn the LED on (HIGH is the voltage level)
37 delay(length); // wait for a second
38 digitalWrite(red, LOW); // turn the LED off by making the voltage LOW
42 void lightGreen(int length) {
43 digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
44 delay(length); // wait for a second
45 digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
46 delay(length); // wait for a second