Traffic Light Controller Programming Code

I have written a sketch for Traffic Light Controller. Can anyone help me if anything seems wrong with this code?? Thanks in advance. :slight_smile:

int red = 13;
int yellow = 12;
int green = 11;
void setup(){
pinMode(red,OUTPUT);
pinMode(yellow,OUTPUT);
pinMode(green,OUTPUT);
}
void loop(){
changeLights(); //defining separate function for changing Traffic Light
delay(10000);
}
void changeLights(){
digitalWrite(green,HIGH); //turn on Green Light for 5s
delay(5000);
digitalWrite(green,LOW); //turn off Green Light
digitalWrite(yellow,HIGH); //turn on Yellow light for 2s
delay(2000);
digitalWrite(yellow,LOW); //turn off Yellow Light
digitalWrite(red,HIGH); //turn on RED light for 3s
delay(3000);
digitalWrite(red,LOW); //turn off Red light
}

Get rid of all the delays functions, and look at the example sketch Blink without Delay. It will help you tremendously.

Thank you Sir :slight_smile:

Where's the push button to let a pedestrian cross the street?