1. Build three LED branches
Place the LEDs in traffic-light order. Connect each anode to its assigned GPIO through a separate 220 ohm resistor and connect all cathodes to ground.
2. Test one color at a time
Before running the full sequence, briefly set each GPIO high in Thonny’s shell. Correct any color or polarity mistakes now.
3. Run the sequence
Upload the program and confirm the order is red, green, then yellow. The show function guarantees only one light is active.
4. Tune the timing
Change the duration values to model a faster tabletop demonstration or a more realistic intersection cycle.