Learn To Code

Micro:bit fun

June 10, 2021

Table of Contents

Set up your micro:bit

It’s really simple to learn to code with your BBC micro:bit

Program

You tell computers like the micro:bit what to do by giving them instructions. Sets of instructions for computers are called programs. Programs are written in code, a language that both you and the computer can understand.

You can program your micro:bit in the online MakeCode block or Python text editors. Our Let’s code page helps you choose the one that’s right for you.

You’ll need either:

  • a computer with a web browser and internet access or
  • a phone or tablet and our free micro:bit app for MakeCode coding on Android or iOS (iPhone and iPad) mobile devices

When you’ve written your code, you’ll want to connect and transfer it onto the micro:bit.

Connect

Connect your micro:bit to your computer or mobile device.

  • If you’re using a computer, you need a micro USB cable to connect to your micro:bit to your computer’s USB socket
  • If you’re using a phone or tablet, use Bluetooth to connect your micro:bit wirelessly Transfer from a computer

emoji-bulb Theme: Flashing

Transferring your program to your micro:bit is called flashing because it copies your program into the micro:bit’s flash memory.


Your micro:bit will pause and the yellow LED on the back will blink while your program is being transferred. Once it’s copied across, your program starts running on your micro:bit.

There are two ways to transfer your program from a computer:

  • Drag and drop is like copying a downloaded file from your computer to a USB memory stick. It works on any computer.
  • Direct flashing sends your program from the code editor direct to your micro:bit. It works on any computer in two popular web browsers.

Microsoft MakeCode

Microsoft’s MakeCode editor is the perfect way to start programming and get creating with the BBC micro:bit. The colour-coded blocks are familiar to anyone who’s previously used Scratch, and yet powerful enough to access all the features of this tiny computer. You can also switch to JavaScript to see the text-based code behind the blocks.

Go to the MakeCode editor. We will be using the JavaScript editor for our examples.

Let’s us take a look at these samples. We will create some of these exercises (and others I found online) using TypeScript and Classes.

We will be building a few different programs in this post. You can find the code for each of them in the CodeSandbox embeds below.

Name Link
Tell Me a Secret Edit tell-me-secret
Duck Teleporting Edit duck-teleporting
Treasure Hunt Edit treasure-hunt