Traffic Lights (Arduino)
Hey! Welcome back to another tutorial! Today, we are going to be making a traffic light using a few LEDs! Also, my Arduino Uno R4 Wifi has come today (10/8/24) so, if you want to see some stuff using it, leave a favorite on this Instructable! Let's get started.
Supplies
The supplies needed for this tutorial are as follows:
- Arduino Uno R3: https://a.co/d/0lki3hk (x1)
- Jumper Wires: https://t.ly/nh7CW (x7-10)
- 100 Ω Resistors (Check resistance before buying!): https://t.ly/zd5ru (x3)
- Small breadboard: https://t.ly/L4lhf
Note: None of the above links are sponsored, or earn me any money. Also, the t.ly links are to an aliexpress shop, I decided to shorten the 100+ char links.
Wiring
Let's start wiring! This step should be fairly simple, as we are just wiring up 3 LEDs with some resistors thrown in. First, you want to connect the GND pin to a negative rail on your breadboard. Next, put 3 LEDs on the breadboard do not put them stacked put them beside each other (left to right)! Now, attach 3 wires to your breadboard to their each of their pins (2, 3, 4). Now, we should have a mess. I mean we should connect resistors to the wires and then connect the wires to their respective LED, the anode of their LED. Now, it's time of coding!
Note: I'm sorry about the explanation, I put a picture for reference :)
Coding
Now that we have finished wiring, we can now code! Like always, I have provided the .ino file for you :). Here is the code for this project.
IMPORTANT: If you use the enableColor function, set the color value as a lowercase string (Eg. Red=red)
Well, this is the end of this tutorial. If you enjoyed this tutorial, please favorite it!
Need Help?
- Have you tried copying and pasting the code?
- Have you confirmed your wiring is correct?
- Have you reset your board?
- If you have done all of the above, please send me a message!