const int greenNorth = 2;
const int yellowNorth = 3;
const int redNorth = 4;
const int greenEast = 5;
const int yellowEast = 6;
const int redEast = 7;
const int greenSouth = 8;
const int yellowSouth = 9;
const int redSouth = 10;
const int greenWest = 11;
const int yellowWest = 12;
const int redWest = 13;
const unsigned long greenDuration = 12000;
const unsigned long yellowDuration = 3000;
const unsigned long cycleDuration = 15000;
void setup() {
pinMode(greenNorth, OUTPUT);
pinMode(yellowNorth, OUTPUT);
pinMode(redNorth, OUTPUT);
pinMode(greenEast, OUTPUT);
pinMode(yellowEast, OUTPUT);
pinMode(redEast, OUTPUT);
pinMode(greenSouth, OUTPUT);
pinMode(yellowSouth, OUTPUT);
pinMode(redSouth, OUTPUT);
pinMode(greenWest, OUTPUT);
pinMode(yellowWest, OUTPUT);
pinMode(redWest, OUTPUT);
}
void loop() {
// For North-South direction
digitalWrite(redWest, HIGH);
digitalWrite(redSouth, HIGH);
digitalWrite(redEast, HIGH);
digitalWrite(greenNorth, HIGH);
delay(greenDuration);
digitalWrite(greenNorth, LOW);
digitalWrite(yellowNorth, HIGH);
delay(yellowDuration);
digitalWrite(yellowNorth, LOW);
digitalWrite(redNorth, HIGH);
digitalWrite(redWest, LOW);
// For East-West direction
digitalWrite(greenWest, HIGH);
delay(greenDuration);
digitalWrite(greenWest, LOW);
digitalWrite(yellowWest, HIGH);
delay(yellowDuration);
digitalWrite(yellowWest, LOW);
digitalWrite(redWest, HIGH);
digitalWrite(redSouth, LOW);
// For South-North direction
digitalWrite(greenSouth, HIGH);
delay(greenDuration);
digitalWrite(greenSouth, LOW);
digitalWrite(yellowSouth, HIGH);
delay(yellowDuration);
digitalWrite(yellowSouth, LOW);
digitalWrite(redSouth, HIGH);
digitalWrite(redEast, LOW);
// For West-East direction
digitalWrite(greenEast, HIGH);
delay(greenDuration);
digitalWrite(greenEast, LOW);
digitalWrite(yellowEast, HIGH);
delay(yellowDuration);
digitalWrite(yellowEast, LOW);
digitalWrite(redEast, HIGH);
digitalWrite(redNorth, LOW);
}