Create a Traffic Light With a Flashing Yellow Light
by Protobject in Teachers > 6
49 Views, 1 Favorites, 0 Comments
Create a Traffic Light With a Flashing Yellow Light
.gif)
In this project, you'll create a realistic traffic light simulation with a flashing yellow phase using Protobject, a web-based platform. This interactive system runs in an infinite loop, mimicking the behavior of an actual traffic light. No extra hardware is needed—just a smartphone and a computer!
With this simulation, you can visualize the full traffic light cycle, including the flashing yellow light before switching to red.
Supplies
- 1 Smartphone (used as the traffic light controller)
- 1 Computer (to access Protobject and configure the system)
- (Optional) Paper Road (to create a mini traffic scene)
- (Optional) Small Toy Car (to make the simulation more interactive)
- (Optional) Cardboard Stand (to hold the smartphone upright like a real traffic light)
Access the Protobject Platform

Open the Protobject platform at https://app.protobject.com using Chrome or any Chromium-based browser (e.g., Edge, Opera).
No sign-up or login required—just open the link and start experimenting!
Add Devices

- Add the Lamp device by opening it on your smartphone.
Program the Traffic Light Simulation

How It Works
The simulation follows a structured traffic light cycle:
- The system runs in a continuous loop, replicating real-world traffic light behavior.
- Inside the loop, a nested sequence controls the flashing yellow light.
- The flashing effect is achieved by alternating between on and off states.
- After flashing, the light switches to red, completing the traffic light cycle.
Open the pre-configured project or view the code with comments explaining each detail.
Test Your Traffic Light
- Create the project and press the Play button.
- Use your smartphone as the traffic light display.
- (Optional) Create a cardboard stand to hold your smartphone vertically like a real traffic light.
- (Optional) Place a paper road and toy car to simulate a real scenario.
- Watch the yellow light flash before the transition to red.
Optional Enhancements
🔊 Sound Effects: Add sounds for each light change to simulate real traffic signals. To achieve this, you may use the MusicalKeyboard component.
⏳ Countdown Timer: Display the remaining time before the light changes by using the WriteDraw component to show numbers.
🚦 Add Another Traffic Light: Set up a second smartphone to display an additional traffic light, simulating a real intersection with alternating signals, just like in a functioning traffic system.
With Protobject, you can quickly prototype and design interactive systems without extra hardware.
Happy coding!