/* Traffic Light Turns on (in order) Green LED, Yellow LED and Red LED, repeatedly. Written by David Connolly Jan. 9, 2014 */ // Pin 0 has a Green LED connected, Pin 3 has a Yellow LED connected, Pin 4 has a Red LED. int greenLed = 0; int yellowLed = 3; int redLed = 4; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(greenLed, OUTPUT); pinMode(yellowLed, OUTPUT); pinMode(redLed, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(greenLed, HIGH); // turn the LED on (HIGH is the voltage level) delay(10000); // wait for 1 second digitalWrite(greenLed, LOW); // turn the LED off by making the voltage LOW //delay(1000); // wait for 1 second digitalWrite(yellowLed, HIGH); // turn the LED on (HIGH is the voltage level) delay(5000); digitalWrite(yellowLed, LOW); // turn the LED off by making the voltage LOW digitalWrite(redLed, HIGH); // turn the LED on (HIGH is the voltage level) delay(10000); digitalWrite(redLed, LOW); // turn the LED off by making the pin voltage LOW }