Getting started with the micro:bit

We’re excited to be offering the micro:bit, so to celebrate we created a few video tutorials to help you get started using and programming the micro:bit with the online Microsoft MakeCode block editor.

Programming Languages

One of the coolest features of the micro:bit is its ability to be programmed with a number of languages:

Microsoft MakeCode block editor — Similar to Scratch and Blockly, users can drag and drop blocks to create programs.

JavaScript — As it turns out, the block editor in MakeCode is interpreted to JavaScript on the back end. If you click “JavaScript” at the top of the page in MakeCode, you can see and edit the JavaScript version of your program.

MicroPythonMicroPython is a subset of the Python language and was developed specifically for microcontrollers. If you’re not a fan of online editors, we’ve had success with the mu editor for creating MicroPython programs.

C++ — The micro:bit is mbed-enabled, which means programs are compiled to a .hex file that you can copy and paste into the root directory of the micro:bit, which enumerates as a mass storage device on your computer. It’s a pretty seamless and slick process, and if you want to get your hands dirty with C++, you can use the mbed “Compiler” editor to write code for the micro:bit.

Now, for some fun projects that’ll get you started using some of the exciting features of the micro:bit:

Electronic Magic 8 Ball

The micro:bit contains an onboard accelerometer that can be read. Using the pre-defined “on shake” function from the drag-and-drop editor, we can tell when the board is shaken and use that event to generate a random message, like “yes,” “no” or “try again.” If you want to get more creative, you can come up with your own responses (here are the original Magic 8 Ball answers).

Temperature Gauge

For the temperature gauge, we get to try out another onboard feature: the temperature sensor. Before you look at your micro:bit and tell us there isn’t a specific chip designed to measure temperature (you’d be correct), let us take a moment to note that there is a temperature sensor built into the main processor. While originally intended for detecting overheating, this sensor can also be used to get a fairly close representation of ambient temperature (as long as the processor isn’t working too hard and getting too hot).

Remote Sensor Alarm

This project examines two-way radio communication, and requires two micro:bits. Using the onboard Bluetooth Low Energy (BLE) radio, it’s possible to program two (or more) micro:bits to talk to each other. In this example, we’ve created an alarm sensor to notify us when someone takes our food from the fridge.

Want Even More?

We recently hosted an hour long webinar about getting started with micro:bit, what's on the board, and how to program it using MakeCode.

Watch Live Coding the micro:bit Webinar

Subscribe to SparkFun Education Blog

Recent Posts

Submit Your Idea