A while back I shared one of my favorite beginner BBC micro:bit projects (click here to go and read about it) – a simple traffic light built with one of those tiny traffic light modules you can find online for just a couple of dollars. It quickly became one of my go-to classroom activities because it combines coding, electronics, and a real-world example in a way that just makes sense to students. They love watching their own little traffic light come to life.
While I was preparing that lesson, another idea popped into my head: What if we built exactly the same project without the traffic light module? After all, the module is really just three LEDs mounted on a small board. Why not recreate it using three separate LEDs instead?
So that’s exactly what I did.
This version uses nothing more than a BBC micro:bit, three LEDs (red, yellow, and green), and six crocodile clip cables. No traffic light module, no breadboard, and no complicated electronics. Students still learn how to connect external components, send digital signals from the micro:bit pins, and build a realistic traffic light sequence in MakeCode – but this time they also get a better understanding of how individual LEDs work and how simple electronic circuits are put together.
I actually love this version just as much as the original. It uses materials that many classrooms already have, it’s inexpensive to prepare, and it still fits comfortably into a single lesson. Sometimes the simplest projects are the ones students remember the most.

Materials list
- A BBC micro:bit (any version)
- A USB cable to connect it to a computer
- 3 LEDs – green, yellow, red
- 6 crocodile clip cables
- Access to makecode.microbit.org (free, no account needed)
Preparation steps
- I went to my nearby electronics hardware store and bought 3 LEDs – a green one, a yellow one and a red one
- I prepared 6 crocodile clip cables, two for each LED – one for the plus leg, one for the minus leg
Logic behind the project
Before we jump into the code, it helps to understand the logic behind a traffic light. I did a lot of research on that. At any given moment, all three lights have a specific state – either ON or OFF. Only one light is on at a time, and each phase lasts for a set amount of time before switching to the next, usually depending on whether the traffic light is serving a big 3-lane boulevard, a small street next to a school or something else.
In MakeCode, we control this using the digital write pin block. Think of it like a light switch for a specific pin on your micro:bit – you tell it which pin and whether to set it to 1 (ON) or 0 (OFF). Digital just means it only has two states – on or off – nothing in between.
For timing, we use the pause (ms) block. This tells the code how long to wait before moving to the next phase. The time is measured in milliseconds -> 1 second = 1000 ms.
Wiring the module
Connect your traffic light module to the micro:bit using crocodile clip cables like this:
- Red LEDs plus leg (long one) → Pin 2
- Yellow LEDs plus leg (long one) → Pin 1
- Green LEDs plus leg (long one) → Pin 0
- All 3 LEDs short minus legs → GND (you can stack the crocodile clip cables on top of each other’s metal parts to make it all fit on the tiny pin of the micro:bit)
Make sure the metal teeth of each crocodile clip are gripping the pin pads on the micro:bit firmly – not the plastic edge.
Coding part
Open makecode.microbit.org and create a new project. Here is how the code is structured: Place a forever block from the Basic menu – this makes your code loop continuously, just like a real traffic light that never stops. Inside the forever block, build three phases:
Green phase:
digital write pin P0 to 1
digital write pin P1 to 0
digital write pin P2 to 0
pause 3000 ms
Yellow phase:
digital write pin P0 to 0
digital write pin P1 to 1
digital write pin P2 to 0
pause 1500 ms
Red phase:
digital write pin P0 to 0
digital write pin P1 to 0
digital write pin P2 to 1
pause 3000 ms
This is how the complete code looks like:

Last but not least, you’ll need a fun way to put your project to use! 😊 Whether you’re trying it out in the classroom with your students or at home with your own kids, this is where the real fun begins. I tested mine with a Mickey Mouse remote-controlled car that I gave my little 4-year-old son for his birthday last year. We placed the LED traffic light on the floor and drove Mickey around the room, pretending we were navigating real roads. Every time we reached the traffic light, we had to stop on red and wait patiently until it turned green before driving off again. It turned into a simple but exciting game that kept the kids entertained while reinforcing the idea of how traffic lights work.

I hope you liked my little project. Try it out and don’t forget to message me if you do and give me feedback. I would love to hear all about it! DM me on Instagram, click here to go to my account :)
If you want a complete ready-to-teach version of this project for your classroom, I have created a full TPT resource that covers everything – wiring diagrams, step-by-step coding instructions, 6 progressive coding tasks, a creative cardboard build section (like the one you see on the picture at the beginning of the post), answer keys, teacher notes with standards alignment, and a full troubleshooting guide. It is designed to be projected directly in class so students can follow along while building at their desks. You can find it here, click this link to the resource.
I also filmed a complete video walkthrough of this project on my YouTube channel – it’s a great companion to this post if you’d like to see everything in action before you start!

[…] If you’d like to try this project using 3 individual LEDs and 6 crocodile clip cables instead of a module, I have a separate post for that version too – check it out here (link)! […]