NEW: code the micro:bit, a Blocks/JavaScript editor! Try it now!

Touch Develop and the BBC micro:bit

From its conception in 2011, the Touch Develop project has been about bringing the joy of learning to program modern devices such as smartphones and tablets, as well as laptops and desktops.

The Touch Develop team is proud to be part of the BBC micro:bit project. The micro:bit is a small wearable and programmable mbed-based device that visibly features a 5x5 LED display, accelerometer, compass, buttons, I/O pins, Micro USB plug, Bluetooth Low Energy antenna, ARM Cortex-M0 processor, and battery plug.

The micro:bit provides a fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it, Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices. The first wave of micro:bits will land in UK schools this autumn, with every Year 7 student in the UK receving a micro:bit, for free.

As a partner on the micro:bit project, we provided: (1) a browser-based introductory programming experience for students who have never programmed before; (2) an architecture that allows students to dig deeper to uncover the many capabilities of the micro:bit; (3) materials and a platform to support teachers with the micro:bit in their classrooms.

Read on to see how we have enhanced Touch Develop and are working with ARM, Lancaster University, and Computing at School to realize these goals.

Try the editors!

Languages, Editors, Compilers

We extended Touch Develop to support a progression of languages with accompanying browser-based editors. The Block Editor provides an introduction to structured programming via blocks that can be snapped together. Touch Develop introduces a statically-typed scripting language with syntax-directed editor.

Browser-based compilers from the Block Editor to Touch Develop and from Touch Develop to C++ automate the transition from a visual language to a text-based language, and then to the language (C++) of the mbed-based micro:bit. The first compiler allows a student to convert a Block Editor script into a Touch Develop script with a single press of a button.

Coding with Touch Develop

To go from the world of browser-based scripting languages to that of the micro:bit's ARM Cortex-M0 Processor , we defined a subset of the Touch Develop language for programming the micro:bit. Here's an example of a Touch Develop script that counts up as the user presses the A button:

Touch Develop count program

The language subset contains: while and for loops; if-then-else conditional statement; functions; local and global variables; integer, boolean, string and image types; operations over values of the above types; user-defined event handlers and libraries.

Compile and Flash

When a student has her Touch Develop script ready (1), she can connect her micro:bit to a computer via a USB cable, so it appears as a mounted drive.

Compilation from Touch Develop to the ARM thumb machine code happens in the browser (2). Read more about the details of building an javascript-based ARM assembler.

The student is prompted to save the ARM binary program to a file, which she then simply drags to the micro:bit mounted drive, which flashes the micro:bit device with the new program (3).

compilation toolchain

Simulator: Test Your Code

Before a student compiles her script for the micro:bit, she can run it using the Touch Develop micro:bit simulator, all within the confines of a web browser. The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.

To run a student's Touch Develop script in the web browser, Touch Develop compiles it into JavaScript, the scripting language built into all web browsers.

C++ and Touch Develop Libraries

The C++ micro:bit library, created at Lancaster University, provides access to the hardware functions of the micro:bit, as well as a set of helper functions (such as displaying a number/image/string on the LED screen). The Touch Develop micro:bit library mirrors the functions of the C++ library. When a Touch Develop script is compiled to C++, the calls to Touch Develop micro:bit functions are replaced with calls to the corresponding C++ functions.

Above, see the mapping from the Touch Develop "show number" function to its corresponding the C++ function.

Resources and Partnerships

In addition to the technology stack described above, we also provide in-depth online resources for the Block Editor, Touch Develop, the Touch Develop micro:bit library, and other Touch Develop resources. The Touch Develop authoring experience allows for "literate programming" and the generation of HTML pages and tutorials that contain example code fragments.

Working with master teachers from Computing at Schools (CAS), we will create micro:bit activities using Touch Develop, mapped to the UK CS curriculum for year 7 students.


The Touch Develop team has run learning events for many years and already has engaged in the UK, running micro:bit workshops at the 2015 CAS conference. We will be part of the BBC's Make It Digital Tour, and plan to work with CAS to bring the micro:bit to their teachers in the fall. We also will be hosting a Virtual micro:bit Conference featuring professors, CAS master teachers, and students.

Over the summer, we will be podcasting micro:bit activities for teachers and students around the UK.