Saturday, 26 March 2016

Micro:Bit



At Hack Oldham's monthly Hack The Library event today I got to play with the soon to be released BBC Micro:Bit.

This is a small PCB with an ARM MCU. It has on board Bluetooth, compass and accelerometer peripherals. And also come with a 5x5 programmable LED matrix and user buttons. The plan is to give one to every year 7 (11-12) kid in the UK and just let them get on with it.

There are several ways to program it, from Scratch like block programming to an implementation of Micro Python.



I tried the block based interface first, but as a classic programmer I found it unwieldy so I got straight in with the Python.

The web based Python editor is ok, and the peripheral documentation is reasonable. I would have liked to see some more detail included though. For example, the accelerometer is fully supported in the API. But it would have been nice to have it documented on the numeric range that the device would output. Not a show stopper, but easy to add to the docs.

After writing your code, clicking the web 'download' button literally downloads a .hex file straight from the browser to the local file system. When the Micro:Bit is connected to a Windows PC, it shows up as a removable drive. The file needs to be copied into this drive, where after downloading it is immediately executed.

If the Python script has any errors, the error is displayed as scrolling text on the 5 x 5 LED display. This is useful, but it would have been great if this could also have been dumped to a text file in the mounted drive. Waiting for an error such as : "Error line 60: Syntax Error" to scroll along a single character display can be frustrating.

Anyway, after half an hour or so I'd managed to write a small game where by tilting the board, a statically illuminated LED is moved towards a flashing LED. When the two meet, a Pacman symbol is flashed (it's a hard coded image, amongst others, in the Micro:Bit) and the two LEDs are randomly re-positioned.

No comments: