In this post I will make one project arduino uno. Project
this time I will make the traffic lights like on the highway, but I use
arduino, to make it more simple in aplikasian in this project.
The first - all we need some electronic components that many
have encountered on the market.
Electronic components are needed:
- Red LED Lamp (1 Piece)
- Yellow LED Lights (1 Piece)
- Green LED Lights (1 Piece)
- Arduino Uno (1 Piece)
- Jumper Cables (Moderation)
- Power Supply 5 Volt Arduino
- Project Board
The above is a component - Electronic components are needed
to make the project this time.
Traffic Lights schemes |
Traffic Lights Arduino schemes |
Sketch of Traffic Lights
// Free Tutorial Arduino // www.ioisalman.com int redPin = 7; // Red light int yellowPin = 6; // Yellow Lights greenPin int = 5; // Green light void setup () { pinMode (redPin, OUTPUT); pinMode (yellowPin, OUTPUT); pinMode (greenPin, OUTPUT); } void loop () { digitalWrite (redPin, HIGH); // Red Lights On digitalWrite (yellowPin, LOW); digitalWrite (greenPin, LOW); delay (3000); // Pause 3 seconds digitalWrite (redPin, LOW); // Yellow Lights On digitalWrite (yellowPin, HIGH); digitalWrite (greenPin, LOW); delay (3000); // Pause 3 seconds digitalWrite (redPin, LOW); // Green Light On digitalWrite (yellowPin, LOW); digitalWrite (greenPin, HIGH); delay (3000); // Pause 3 seconds }
Note:
- Make the traffic lights in this order: Red - Yellow (blinking 3x) - Green
instructions:
Line program for Yellow light:
digitalWrite (redPin, LOW); // Yellow Lights On
digitalWrite (yellowPin, HIGH);
digitalWrite (greenPin, LOW);
delay (3000); // Pause 3 seconds
replaced:
for (int i = 1; i <= 3; i ++)
{
digitalWrite (yellowPin, HIGH);
delay (1000);
digitalWrite (yellowPin, LOW);
delay (1000);
}
0 Response to "How to Make TRAFFIC LIGHT Arduino"
Post a Comment