I am excited to share my traffic light system project. This project uses a Micro:bit connected to an MLBB board with RGB LEDs to simulate real-life traffic signals.
In real traffic systems, red lights mean stop, green lights mean go, and yellow lights signal caution. I programmed the Micro:bit to replicate these signals using MakeCode. My code starts with an on start block, which runs once to initialize the program. Then, a forever block loops the actions continuously, making the lights cycle just like real traffic lights.
I also used show LEDs to design patterns on the 25 LEDs and show string to display words like “Traffic Lights” on the Micro:bit screen. To make it interactive, pressing the logo triggers the sequence: first, a red LED turns on for stopping, then a yellow LED for caution, and finally a green LED for going. I added pauses between each light so the sequence is clear and easy to follow.
During the demo, the red LED appeared first, followed by yellow, and finally green, staying on until the end. Using this project, I learned how to combine coding and electronics to mimic real-world systems. It was exciting to see the Micro:bit control the LEDs just like a real traffic light, and it gave me a better understanding of both programming and traffic safety.