If you are new to Arduino and wants to do some experiment on it for experience, then this project is perfect for you. It is a simple tutorial, which involves amalgamation of a friendly code and an easy circuit to build an Arduino based Traffic light circuit. It will introduce you to the basic concept of Arduino.
The equipment required for this project includes Arduino Uno, Red, Yellow and green LED, 3 x 100 Ohm resistors of Brown Black Brown color, four Breadboard wires and a Breadboard. The circuit required for Arduino Traffic Light is indeed simple and non-time consuming. The following diagram can assist you to complete your circuit but if you are searching for an advanced program to prototype and design diagrams, then check out Fritzing.
The code will help you to light up the LEDs and bring life to this project. They are basic if you’re a programmer but if you are new in this field of programming, then it’s a great platform to learn. It is prominent to declare the variables before initiating the writing. For example, the GREEN variable represents the pin to which the green LED is connected to and same concept is applied to other variables.
After the variables are set, the pins are arranged as they act as an output and not as an input. Further, we understand that the pinMode function admits two parameters i.e. the pin number and the mode. The role of this function is to create a loop for the program to run through it. Hence, whenever the function is called, it will turn the lights on and afterward we can set a delay to avoid changes until that time is up.
The same procedure is followed and a function is created for each light. In the end, you will see that the green light () function will turn the green light on and simultaneously turn the yellow and red LEDS off. After the code is completed and tested using verify button, it is uploaded to Arduino with the help of a USB cable. The lights must begin to blink in the defined pattern using the function calls and the delays. If not, there must be some errors in your code.
This is a great beginner project if you are just introduced to your first Arduino or looking at buying one. Check out the video to cover what you will need to do from start to finish in this project. For codes and other details, visit the following link.
Filed Under: Reviews
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.