My first IOT project will be a pair of traffic lights that are simulating an intersection.
Iteration 1 - Time Controlled Traffic Lights:
I've connected six LED's to the outputs of the Arduino Uno. A simple C++ program controls it. The program toggles between the two sets of traffic lights in a sequence that is common in Europe.
Design and the code that I wrote. I used TinkerCad for making the drawing. |
The code and the latest version of the sketch is available on my TinkerCad page.
Step 2 - Emergency Button
The next step is to add an "Emergency Button". Whenever someone presses that button, both sets of traffic lights switches to red and wait until the user presses the button again. Further, the RGB led will blink during that time.
I only use two input pins for the RGB LED, since that will blink in red or blue only. I control the brightness of that LED with Pulse Width Modulation. |
When the user pushes the button (button state changes to HIGH), the system will either enter or leave the emergency state.
I had some issues with the board leaving the emergency state. The fault was mine - I messed up the output numbers and I sent output to input ports.
The next step will be more complex - I'll add a 16x2 LCD display to the system that will print some useful information to the user.
No comments:
Post a Comment