Year 7

micro:bit Reference

Everything you need to programme, connect and troubleshoot your micro:bit.

What is the micro:bit?

A tiny, pocket-sized computer. Here's what's on the front face:

A B USB connector 5×5 LED grid Button A Button B Reset button Edge connector pins

MakeCode quick reference

BlockWhat it doesUsed in
show stringScrolls text across the LED grid.Lesson 2
show iconDisplays a fixed image on the LED grid.Lesson 2
pause (ms)Waits before running the next block.Lesson 7
foreverRepeats the blocks inside it forever.Lesson 7
on button A pressedRuns code when button A is pressed.Lesson 10
if / elseRuns different code depending on a condition (selection).Lesson 10, 11
on shakeRuns code when the micro:bit is shaken (accelerometer).Lesson 11
pick randomPicks a random number in a range.Lesson 11
change variable byAdds to or subtracts from a stored number, e.g. a score.Lesson 10, 11

Step-by-step: connecting and downloading

  1. Plug your micro:bit into the computer with a USB cable.
  2. It should appear as a drive called MICROBIT.
  3. Build your programme at makecode.microbit.org.
  4. Click Download — this saves a .hex file.
  5. Drag the .hex file onto the MICROBIT drive.
  6. Wait for the yellow light on the back to stop flashing — that means it's saved.

Troubleshooting

Check the USB cable is a data cable, not just a charging cable. Try a different USB port. If it still doesn't work, restart the computer.

Re-download the file and make sure it lands on the MICROBIT drive, not somewhere else like Downloads.

Check you used the right "on button pressed" block and that the download actually finished (the yellow light stopped flashing).

Check whether your blocks are inside "on start" (runs once) or "forever" (runs again and again) — you may have blocks in the wrong one.

Official tutorials

More step-by-step guides straight from the makers of MakeCode: makecode.microbit.org/projects

Lesson projects quick reference