How to Make a Traffic Light Blink With Arduino

first get familiar with your parts.




male wires

resistors( if u get the wrong one the lights won't work)

Step 1: Setup

Step 2: Making a Variable

int redled= 13; // declares that the name redled is the same as 13

int yellowled= 12; // declares that the name yellowled is the same as 12

int greenled= 11; // declares that the name greenled is the same as 11

Step 3: Setup

void setup(){

pinMode(greenled,OUTPUT); // declares the green led as an output

pinMode(yellowled, OUTPUT); // declares the yellow led as an output

pinMode(redled, OUTPUT);// declares the red led as an output


Step 4: The Loop

void loop(){ // keeps the code on until it is stopped by a person

digitalWrite(greenled, HIGH); // turns on the green light

delay(3000);// sets how long the green light would stay

digitalWrite(greenled, LOW); // turns the green light off

digitalWrite(yellowled,HIGH);// turns yellow light on

delay(3000); // sets how long the yellow light will stay on

digitalWrite(yellowled,LOW);// turns yellow light off

digitalWrite(redled,HIGH);// turns red light on

delay(3000);// sets how long the red light will stay on

digitalWrite(redled,LOW);// shuts off the red light

} // the end of the code

Step 5: What Should Happen



    • Epilog X Contest

      Epilog X Contest
    • Organization Contest

      Organization Contest
    • Build a Tool Contest

      Build a Tool Contest

    3 Discussions


    1 year ago

    cool project, really clear


    1 year ago

    Thanks for sharing :)