Blinking Light with Micro:bit

In this project, learners are introduced to the BBC Micro:bit through a fun blinking light activity. They write simple programs to control Light Emitting Diode (LEDs), and discovering how clear instructions guide computer’s actions. We have included extra challenges that encourage learners to experiment with different light patterns, making learning playful and interactive. Through this hands-on experience, learners develop creativity, problem-solving skills, and confidence while connecting coding and robotics to real-world applications like toys, electronics, and wearable devices. The project also sparks imagination with AI ideas, showing how smart systems can respond, adapt, and make decisions.

ItemPurpose
Micro:bit (V2 or V1)Main microcontroller board
Micro USB cableConnects Micro:bit to your computer
Breadboard (optional)For building the circuit
LEDLights up to show output (any color works)
220Ω resistorProtects the LED from too much current
Jumper wiresFor making electrical connections
Alligator clips (optional)Easy connections without a breadboard

The Micro:bit has built-in LED lights on its front, but for this project, we will use an external LED to learn about circuits.

An LED has two legs:

  • Long leg (Anode) → Connects to P0 (Pin 0) on the Micro:bit

  • Short leg (Cathode) → Connects to GND (Ground) on the Micro:bit

Circuit Connections
  1. Place the LED on the breadboard.

  2. Connect the short leg (–) of the LED to GND on the Micro:bit.

  3. Connect the long leg (+) of the LED to one end of the 220Ω resistor.

  4. Connect the other end of the resistor to Pin 0 on the Micro:bit.

Tip: If you don’t have a breadboard, you can connect wires directly using alligator clips.

Follow these steps carefully to open and explore the project in Microsoft MakeCode for Micro:bit:

Plug in your Micro:bit to your computer using a USB cable, then follow the steps in the video to upload your code and bring your project to life!

Code BlockWhat It does
foreverThis block keeps repeating the instructions inside it.
digital write pin P0 to 1Turns the LED ON by sending power through pin P0.
pause (1000)Waits 1 second (1000 milliseconds) before doing the next action.
 digital write pin P0 to 0Turns the LED OFF by stopping the power from pin P0.
 pause (1000)Waits another second before starting again.

If the LED doesn’t blink:

  • Check if the LED is connected the right way (long leg = P0, short leg = GND).

  • Ensure the resistor is connected between P0 and the LED.

  • Make sure your Micro:bit is powered and the program uploaded correctly.

  • Try using another pin (like P1 or P2) and update the code accordingly.

  • How to connect and control an LED using the Micro:bit pins
  • The difference between digital ON (1) and OFF (0) signals in MakeCode
  • How to use the forever block to make your program run continuously
  • How timing works with the pause block (in milliseconds)
  • How to use digital write pin blocks to turn components ON and OFF

Try these fun ideas:

  • Double Blink: Make the LED blink twice quickly, then pause.

  • Multiple LEDs: Add more LEDs on P1 and P2, make them blink alternately!

  • Sound Sync: If you have Micro:bit V2, add beeps using the built-in speaker while the LED blinks.

Use either Micro:bit's CreateAI or Edge Impulse to build, train, and deploy machine learning (ML) models to make the blinking lights more intelligent and playful. With CreateAI, the Micro:bit can learn from simple patterns and predict what should happen next.

For example:

  • Pattern Predictor: The Micro:bit checks how students press a button to change LED blinking patterns. After a few tries, it can guess the next pattern and blink the lights automatically.

  • Fun Game: Students can play a “guess the blink” game where the AI tries to repeat the pattern they create, making learning interactive and playful.