Muhammad_Munir
Published © GPL3+

Traffic Signal Light Simulator

How to make Traffic Signal Light Simulator by using Arduino

IntermediateFull instructions provided2,657
Traffic Signal Light Simulator

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Red
5 mm LED: Red
×4
5 mm LED: Green
5 mm LED: Green
×4
5 mm LED: Yellow
5 mm LED: Yellow
×4
Wires
×1
Ice cream Sticks
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Code

Arduino
#define LEDRED1 2
#define LEDYELLOW1 3
#define LEDGREEN1 4

#define LEDRED2 5
#define LEDYELLOW2 6
#define LEDGREEN2 7

#define LEDRED3 8
#define LEDYELLOW3 9
#define LEDGREEN3 10

#define LEDRED4 11
#define LEDYELLOW4 12
#define LEDGREEN4 13
void setup() 
{
    pinMode(LEDRED1, OUTPUT);
    pinMode(LEDYELLOW1, OUTPUT); 
    pinMode(LEDGREEN1, OUTPUT);
    pinMode(LEDRED2, OUTPUT); 
    pinMode(LEDYELLOW2, OUTPUT);
    pinMode(LEDGREEN2, OUTPUT);
    pinMode(LEDRED3, OUTPUT); 
    pinMode(LEDYELLOW3, OUTPUT);
    pinMode(LEDGREEN3, OUTPUT); 
    pinMode(LEDRED4, OUTPUT);
    pinMode(LEDYELLOW4, OUTPUT); 
    pinMode(LEDGREEN4, OUTPUT);
      
}
void loop()
{           digitalWrite(LEDRED4,HIGH);
            digitalWrite(LEDRED3,HIGH);
            digitalWrite(LEDRED2,HIGH);
            digitalWrite(LEDRED1,HIGH);
            
            digitalWrite(LEDYELLOW1,HIGH);
            delay(2000);
            digitalWrite(LEDGREEN1,HIGH);
            digitalWrite(LEDYELLOW1,LOW);
            digitalWrite(LEDRED1,LOW);
            delay(10000);
            digitalWrite(LEDGREEN1,LOW);
            digitalWrite(LEDRED1,HIGH);

            digitalWrite(LEDRED2,HIGH);
            
            digitalWrite(LEDYELLOW2,HIGH);
            delay(2000);
            digitalWrite(LEDGREEN2,HIGH);
            digitalWrite(LEDYELLOW2,LOW);
            digitalWrite(LEDRED2,LOW);
            delay(10000);
            digitalWrite(LEDGREEN2,LOW);
            digitalWrite(LEDRED2,HIGH);

            digitalWrite(LEDRED3,HIGH);
           
            digitalWrite(LEDYELLOW3,HIGH);
            delay(2000);
            digitalWrite(LEDGREEN3,HIGH);
            digitalWrite(LEDYELLOW3,LOW);
            digitalWrite(LEDRED3,LOW);
            delay(10000);
            digitalWrite(LEDGREEN3,LOW);
            digitalWrite(LEDRED3,HIGH);

            digitalWrite(LEDRED4,HIGH);
           
            digitalWrite(LEDYELLOW4,HIGH);
            delay(2000);
            digitalWrite(LEDGREEN4,HIGH);
            digitalWrite(LEDYELLOW4,LOW);
            digitalWrite(LEDRED4,LOW);
            delay(10000);
            digitalWrite(LEDGREEN4,LOW);
            digitalWrite(LEDRED4,HIGH);
            
}

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments