Coding Club

BBC micro:bit

Six projects for the BBC micro:bit, a tiny computer with 25 lights, two buttons, a speaker and sensors for movement, light and temperature. You write real Python in the free micro:bit Python Editor and try it in the simulator, then send it to a micro:bit and hold it in your hand.

Six days, six projects

One small project a session. Each one is a numbered list of steps with a picture of what to click and what you should see, then tests and stretch challenges for anyone who finishes early.

A heart beating on a micro:bit.
Day 1Hello micro:bitLight up a heart, scroll your name, draw your own picture and make a heart that beats forever.
Button Buddy, happy because A is pressed.
Day 2Button BuddyMake a little pet that sleeps until you press its buttons, then smiles, frowns or gasps.
The dice has landed on five.
Day 3Shake DiceTurn the micro:bit into a dice: shake it, watch it roll, and see where it lands.
Music Maker, playing a tune.
Day 4Music MakerPlay a tune you write note by note, then bend the pitch by tilting the micro:bit, like a real instrument.
Warm today: the weather station shows a sun.
Day 5Weather StationMeasure the temperature and the light, show a sun or a snowflake, and switch on a night light in the dark.
A star falls towards the player.
Day 6Catch the StarProgram a real game: move left and right with the buttons to catch the falling stars before you run out of lives.

Get set up before day 1

You will need

  • A computer with Chrome or Edge (for sending programs to the micro:bit)
  • A micro:bit (V2 is best) and a USB data cable, one per pair
  • No micro:bit? The editor's simulator runs every project
  • No account needed
  1. Setup step 1: Open the micro:bit Python Editor

    Open Chrome or Edge and go to python.microbit.org. It is free and needs no account. It opens with a short program already written, which shows a heart and then scrolls the word Hello.

    Your code goes in the middle. Down the left are Reference, Ideas and API, which are full of examples to copy, and on the right is a simulated micro:bit.

    The editor: tabs on the left, your code in the middle, the simulator on the right.
  2. Setup step 2: Try the simulator

    Press the simulator's play button. It runs the program in the editor, exactly as a real micro:bit would. You can press its A and B buttons with the mouse, and the controls under it can shake it, warm it up or shine a light on it. Press the button again to stop.

    Press play, and the simulated micro:bit shows a heart.
  3. Setup step 3: Plug in your micro:bit

    Connect your micro:bit to the computer with its USB cable. A small yellow light on the back comes on. The cable must be a data cable: some phone charging cables only carry power, and then the computer never sees the micro:bit.

  4. Setup step 4: Send a program to it

    Click Send to micro:bit. The first time, the editor shows you how to connect: choose your micro:bit in the box that pops up and click Connect. A few seconds later the program is running on your real micro:bit, and it stays there, even after you unplug it.

    Send to micro:bit puts the program onto your real micro:bit.
    Watch out Sending this way needs Chrome or Edge. In any other browser, click Save, which saves a .hex file, then drag that file onto the MICROBIT drive, just like copying to a USB stick.
  5. Setup step 5: Name and save your project

    Click the project name at the top to rename it. Save downloads your project as a .hex file, which you can open again next time with Open…. The editor also keeps your latest work in the browser.

    Rename the project, then Save keeps a copy you can open again.
Notes for the teacher

Before the first session

  1. Open python.microbit.org on a club computer in Chrome or Edge, to check it is not blocked by the school's filter. Sending straight to a micro:bit needs one of these two browsers.
  2. Check each micro:bit's USB cable carries data: plug it in and look for a MICROBIT drive.
  3. A micro:bit V2 is best: it has a speaker, a microphone and a touch logo. A V1 does everything except the sounds and day 2's logo, which have notes saying what to do instead.
  4. No micro:bits at all? Every project works in the editor's simulator.

How the six projects build up

Day 1 is sequence and loops, day 2 selection with the buttons, day 3 random numbers and lists, day 4 sound and a sensor, day 5 more sensors and comparisons, and day 6 puts it all together in a game.