#define REDCARS 13
#define YELLOWCARS 12
#define GREENCARS 11
#define GREENPEDESTRIANS 10
#define REDPEDESTRIANS 9
#define BUTTON 6
#define SIGNAL 3
void setup()
{
pinMode(REDCARS, OUTPUT);
pinMode(YELLOWCARS, OUTPUT);
pinMode(GREENCARS, OUTPUT);
pinMode(REDPEDESTRIANS, OUTPUT);
pinMode(GREENPEDESTRIANS, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
pinMode(SIGNAL, OUTPUT);
digitalWrite(REDCARS, LOW);
digitalWrite(YELLOWCARS,LOW);
digitalWrite(GREENCARS, HIGH);
digitalWrite(REDPEDESTRIANS, HIGH);
digitalWrite(GREENPEDESTRIANS, LOW);
}
void loop()
{
if(digitalRead(BUTTON)==LOW)
{
digitalWrite(SIGNAL, HIGH);
delay(5000);
digitalWrite(YELLOWCARS, HIGH);
digitalWrite(GREENCARS, LOW);
delay(2000);
digitalWrite(YELLOWCARS, LOW);
digitalWrite(REDCARS, HIGH);
digitalWrite(SIGNAL, LOW);
digitalWrite(REDPEDESTRIANS, LOW);
digitalWrite(GREENPEDESTRIANS, HIGH);
}
{
}
}