Introduction: Arduino Traffic Light

Resources from: https://www.instructables.com/id/Arduino-Traffic-L...

This is very easy worked to do. Even if you just started to use Arduino you can make it too. Now lets begin our lesson.

Step 1: Step 1: Materials & Tools

1. Materials:

Resistor 10 k ohm

Resistor 220 ohm

Breadboard

Connecting wires

Red/ Green/ Yellow LED

2. Tools:

Paper or a pretty box

Box

Glue/Hot melt adhesive/tape

Painted utensils

scissors

Step 2: Step 2: Introduction of This Work

This work is a very simple work. The main thing is that the LED lights are flashing. It is also very easy for beginners. In addition, the decoration will be done to prevent the work from being so monotonous and more beautiful.

Step 3: Step 3: Run a Program

int red = 10;

int yellow = 9;

int green = 8;

void setup() {

pinMode(red, OUTPUT);

pinMode(yellow, OUTPUT);

pinMode(green, OUTPUT);

}

void loop(){

changeLights();

delay(15000);

}

void changeLights(){

// green off, yellow on for 5 seconds //改3 seconds 為5

digitalWrite(green, LOW);

digitalWrite(yellow, HIGH);

delay(3000);

// turn off yellow, then turn red on for 8 seconds //改5 seconds 為8

digitalWrite(yellow, LOW);

digitalWrite(red, HIGH);

delay(5000);

// red and yellow on for 2 seconds (red is already on though)

digitalWrite(yellow, HIGH);

delay(2000);

// turn off red and yellow, then turn on green

digitalWrite(yellow, LOW);

digitalWrite(red, LOW);

digitalWrite(green, HIGH);

delay(3000); }

Step 4: Step 4 : Decoration for This Worked

First, Finish your bread board, and make sure it can work smoothly.

Second, Find a box that can put your bread board inside it.

Third, Started to decorate your box( If you already choose a pretty box then don't need to do the decorate.)

Forth, Put your Connecting wires on and cut a hole for your wires.

Fifth, Connect to the computer.

Sixth, Check your work, if it work smooth and the outside look is perfect then you finish!

Step 5: Step 5: Ending

This is just an example for people who want to try to do this work. And this is my own work. Usually, I am just a beginner of Arduino. So people who just started to use Arduino, but wanted to make up a worked. You can take this lesson for your first worked and try it. It is very easy, I can promise that.