Traffic light module with TinkerPie
Three LEDs in a row: crossings and timers.
| Type | Outputs and actuators |
|---|---|
| Connect to | R, Y and G on three pins |
| Gives | red, yellow, green |
| Simulator | Yes: a control appears under the simulated board |
How it works
The traffic light module has red, yellow and green LEDs with their resistors already fitted. Each colour has its own pin, and all share one ground.
How to wire it
Signal pin to S1-S4 or P10-P13. Motors, pumps and lamps always go through the relay or a driver module, never straight to a pin.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
outputs.trafficLight(Pin.P10, Pin.P11, Pin.P12, TrafficLight.Green)
// Arduino C++
outputs::trafficLight(Pin::P10, Pin::P11, Pin::P12, TrafficLight::Green) Good to know
- Program the real sequence: red, red and yellow, green, yellow, red.
- Use pauses to set how long each light stays on.
- Combine it with a button for a pedestrian crossing.
Projects with the Traffic light module
Similar modules
- Relay module
- LED module
- Laser module
- Active buzzer module
- DC fan / motor module (with transistor)
- 16-channel servo driver PCA9685
Questions
Can I try the Traffic light module without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
What is the order of a real traffic light?
In India a common order is red, then green, then yellow, then red again; some places also show red and yellow together before green. Try both in the Traffic light project.