The Story So Far

In Part 1 of my BBC micro:bit series, I explained the background of the BBC micro:bit, a remarkable programmable device which will inspire school children to get creative with coding and making things. I also shared a quick look at its architecture and main features.  In Part 2, I gave a guided tour of the micro:bit’s default Bluetooth® profile. In this final blog post, I’ll be examining ways in which you can create code for the micro:bit, and how you can write code for other devices which allow them to interact with the micro:bit over Bluetooth.

Take Your Pick

One of the things I think sets the micro:bit apart from other comparable devices for the education sector is the fact there’s a significant collection of tools and languages available to the budding programmer. The fact that this has been accomplished in such a short time is testimony to the level of support there is out there from all sorts of organisations and technical communities.

There are several development tools for the complete beginner and I’ll discuss them next. But there are also approaches to developing for micro:bit which, coupled with the fact that its runtime is open source, mean you can get in very deep and learn anything and everything about what makes this device tick. There’s a joke about timers in there somewhere. I’ll leave that one to you.

This means the barrier to entry for becoming a micro:bit developer is very low but the ceiling governing how much you can learn is very high. Want to know how multiplexing and persistance of vision is used to make the micro:bit 5 x 5 LED display work? It’s all there in the runtime code and it’s described in Lancaster University’s excellent documentation.

Development Tools for Beginners

The BBC provided a collection of online development tools for beginners. I’ll discuss them shortly. Since the BBC’s site was launched, Microsoft has been busy creating their own micro:bit development site and I’ve been working with them to provide comprehensive capabilities for developers who want to make use of Bluetooth on the micro:bit.

codethemicrobit.com

The new Microsoft site is www.codethemicrobit.com and, in my opinion, it is by far the best of the online micro:bit development tools for beginners and the best tool if you want full access to the micro:bit’s Bluetooth profile.

It provides a visual programming, drag-and-drop tool involving building application logic by arranging graphical programming blocks representing predefined, parameterised functions. And it’s very easy to use.

To use Bluetooth in your micro:bit application you first need to add the Bluetooth package to your project using the menu More/Add Package.

Figure 1 – Adding the Bluetooth® Package to a codethemicrobit Project

Once this is done, you have a complete collection of Bluetooth related ‘blocks’ with which to build the Bluetooth capabilities of your application. Many are very simple and merely result in a given Bluetooth service being available at run-time. But there are also blocks which provide access to Bluetooth connect and disconnect events and the Bluetooth UART service can be used to transmit arbitrary data to a connected peer or to receive data from a peer device.

Figure 2 – The codethemicrobit Bluetooth Package

If you read part 2 of my micro:bit blog series you’ll probably spot that there are a few services missing from the list of blocks above. For historical reasons relating to the BBC requirements, the Device Information, DFU and Event services are currently included automatically as long as you use at least one of the other services from the Bluetooth blocks shown above. We still have some work to do and the aim is for all Bluetooth services to have their own blocks in the codethemicrobit.com Bluetooth package so that you have complete control over exactly what Bluetooth capabilities your micro:bit code has.

To illustrate the power of codethemicrobit.com, here’s an application which implements the micro:bit side of my Animal Vegetable Mineral guessing game which you can see on our micro:bit page or in YouTube. It took only 10 minutes to create.

Figure 3 – micro:bit Animal, Vegetable, Mineral Guessing Game

I think Microsoft’s codethemicrobit.com is just fantastic and the team behind it has done an amazing job. It’s easy and it’s flexible, most importantly, for Bluetooth® developers there are only a few constraints regarding what you can or cannot do.

FEATURED DOWNLOAD

An Introduction to Bluetooth Low Energy Development

This self-study educational resource covers both theory and practice of Bluetooth Low Energy GAP and GATT application development. The guide will equip you with a solid understanding of key Bluetooth Low Energy concepts before guiding you through a series of software development projects that will allow you to put the theory into practice.

INSTANT DOWNLOAD

microbit.co.uk

The BBC’s online tools for the beginner are all available at www.microbit.co.uk . Two are from Microsoft and are called “Blocks” and “Touch Develop” (or “TD” for short). The third is from a company called Code Kingdom and I’m informed it sits on top of Microsoft’s TD APIs.

All three of these tools are suitable for beginners. Blocks is similar to Microsoft’s tool at codethemicrobit.com but does have a number of limitations, including with respect to Bluetooth.

Figure 4 – The Microsoft Block Editor

TD and the Code Kingdom editors use scripting but within what I can only describe as an intelligent user interface which guides and assists. They best way to get a feel for this is to give it a try.

Figure 5 – Touch Develop and the Code Kingdoms Editors Side by Side

Even with these three tools for beginners you can create Bluetooth applications. You are limited to a range of predefined use cases designed to be used in conjunction with the official micro:bit Android application from Samsung but you can still do some very cool things. These limitations were implemented to ensure things stay as simple as possible for the novice developer whilst introducing them to the world of wireless communications. There are other tools for those who want to do more and I’ll cover those shortly.

The Samsung Android application allows developers to write code and flash it over Bluetooth® to their micro:bit all without touching a PC of any sort. You can code on your phone or tablet which is a fantastic capability. Microsoft’s Blocks’ editor seems particularly well suited for this. Here’s a video of me programming my micro:bit to be a music player Bluetooth remote control. Watch just how easy and gratifying this is.

An Introduction to the Bluetooth LE Security Study Guide

My house has locking doors and windows, an alarm system, and several security cameras.…

Why Bluetooth Technology is the Developer’s Swiss Army Knife

Members of the Bluetooth® community are continuously innovating. Over the last two decades, members have…

Updates to the Bluetooth Internet Gateway Study Guide

According to the ABI report Installed Base of IoT Devices by Connectivity Technology, published…

In Case You Missed It: What’s New With Blue This Summer

The Bluetooth® developer community is always pushing the technology forward, and this summer has…

New Core Specification v5.3 Feature Enhancements

One of the key reasons why Bluetooth® technology has emerged as the global wireless…

Bluetooth® Core Specification Version 5.3 Feature Enhancements

Bluetooth® Core Specification version 5.3 includes several feature enhancements with the potential to improve…

Connect: Car Access Demo

In this demo, Texas Instruments will discuss and demonstrate Bluetooth 5.1 and its cutting…

Wireless Connectivity Options for IoT Applications - Commercial Lighting

Industry 4.0 is no longer a thing of the future. The term describes the…

4 Essential Tools for Every Bluetooth Low Energy Developer

One of the biggest challenges of learning any new technology is knowing which tools…

Designing and Developing Bluetooth® Internet Gateways

Learn about Bluetooth internet gateways, how to make them secure and scalable, and design and implement your own working prototype gateway and web application for use with either Bluetooth LE Peripherals or with Bluetooth mesh networks.

An Introduction to Bluetooth Low Energy for Swift Developers

All smartphones support Bluetooth® Low Energy (LE) and it is used in all manner…

Building a Sensor-Driven Lighting Control System Based on Bluetooth® Mesh

A technical examination of which Bluetooth mesh models to use in different types of…

How Bluetooth Low Energy Works: 21 Interesting Facts

Whether you’re a beginner or an expert in Bluetooth Low Energy development, it’s always…

Advanced Bluetooth for Android Developers

Android developers can take this guided tour of the most recent features and interesting…

How to Deploy BlueZ on a Raspberry Pi Board as a Bluetooth Mesh Provisioner

This step-by-step study guide will teach you: How to rebuild the kernel on a…

The Bluetooth LE Security Study Guide

Learn about fundamental security concepts, the security features of Bluetooth Low Energy, and gain some hands-on experience using those features in device code.

How Bluetooth 5 Increases the Achievable Range of a Bluetooth Low Energy Connection

Texas Instruments offers their theory on how to achieve long range with a Bluetooth…

Testing Long Range (Coded PHY) with Nordic Solution (It Simply Works)

There has been a lot of discussion and confusion about testing the long range…

 Get Help