//Project 2 - Traffic Lights Arduino
int ledDelay = 500; // delay in between changes
int redPin = 10;
int yellowPin = 9;
int greenPin = 8;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
digitalWrite(redPin, HIGH); // trun the red light on
delay(ledDelay); // wait 5 seconds
digitalWrite(yellowPin, HIGH); // trun on yellow
delay(2000); // wait 2 seconds
digitalWrite(greenPin, HIGH); // trun green on
digitalWrite(redPin, LOW); // trun red off
digitalWrite(yellowPin, LOW); // trun yellow off
delay(ledDelay); // wait ledDelay milliseconds
digitalWrite(yellowPin, HIGH); // trun yellow on
digitalWrite(greenPin, LOW); // trun green off
delay(2000); // wait 2 seconds
digitalWrite(yellowPin, LOW); // trun yellow off
// now our loop reapeats
}