How do I set up a BBC micro:bit on my Mac?
The BBC micro:bit computer is a small, pocket-sized computer board with LEDs, buttons and motion-detecting sensors. It's been handed out for free to schoolchildren in the UK to encourage coding and science; it's also on sale to the general public.
You can buy a BBC micro:bit for just £13 from shops in the UK and quickly set it up using a web browser, like Safari or Chrome, on a Mac.
In this article we'll look at how to set up and start using a BBC micro:bit controller using an Apple Mac computer.
- Why you should learn to code (and how to do it)
- Learn how to code in Java on a Mac
- How to set up and learn Python coding on a Mac
- Learn code with Swift Playgrounds
How to set up & use a BBC micro:bit with a Mac: Powering up and switching on
You connect the BBC micro:bit to a power source in one of two ways:
- Use a micro USB cable to connect your BBC micro:bit to a USB port on your Mac (or to a power adaptor such as the one that came with your iPhone).
- Connect a micro:bit battery adaptor to the battery connection.
The battery is used to power the BBC micro:bit when you're out and about, but it isn't used to set up the BBC micro:bit. To create and transfer your own programs, you'll need to connect the micro:bit to your Apple Mac using the micro USB connection.
How to set up & use a BBC micro:bit with a Mac: Starting up
Starting up the micro:bit is easy. You connect it to the power and follow the instructions on the LED display. This first program flashes the LED lights, and then walks you through a few of its features.
- Connect the BBC micro:bit to the power. The LED display will light up.
- You'll be asked to press the buttons A and B. Buttons can be set as inputs in your programs, enabling you to create controls.
- Shake the screen. The BBC micro:bit has a built-in accelerometer, like an iPhone. This can detect which way you're moving the device.
- Next you'll be asked to tilt the bbc micro:bit to move a dot (to catch a flashing dot).
This sequence will run each time you power up the BBC micro:bit until you create, and upload, your own program to it.
There is an Easter Egg in the BBC micro:bit setup sequence. Press and hold the A and B button at the same time when you see the heart animation to unlock a game of Snake.
How to set up & use a BBC micro:bit with a Mac: Learning to program
Now that you've powered up and connected your BBC micro:bit it's time to start making your own programs.
The process of uploading programs from your computer to the BBC micro:bit is pretty easy. You log on to the BBC micro:bit website, and use to create code. There are four different code editors available:
- Microsoft Block Editor. A graphical, drag and drop code editor, where coding blocks snap together.
- Microsoft Touch Develop. A flexible, text-based programming language, which comes with a BBC micro:bit library of commands installed.
- An easy-to-learn programming language for everyone, from kids to teachers to professional software engineers.
Microsoft Block Editor is probably the easiest code environment, while Python is the most advanced. There's plenty of documentation and example programs on microbit.co.uk.
How to set up & use a BBC micro:bit with a Mac: Create a Hello World program
Programs created on the microbit.co.uk website are downloaded as files, transferred to the root of the BBC micro:bit drive and then run automatically.
After you've created the program in the website, you download it as a .HEX file. This is saved to your Downloads folder, and you drag-and-drop it directly onto the BBC micro:bit device in Finder.
- Open a web browser and log on to http://www.microbit.co.uk.
- Click on Create Code.
- Click on New Project under Microsoft Block Editor.
- Click Basic and drag a Show String block from the sidebar to the stage.
- Double-click "Hello" and change the text to "Hello, World!"
- Click the Play icon to see the text running on a BBC micro:bit simulator.
- Click anywhere on the screen to return to the editor window.
- Click Download to save the file to your Downloads folder.
- Open the Downloads folder. Click and drag the .HEX file to the microbit section in the Finder sidebar (under devices).
Eject the BBC micro:bit and remove the cable. Now reconnect it. You will see the words "Hello, World" scroll across the LED display.