Pages

Friday, 20 January 2017

MicroPython on the BBC micro:bit - easy as Pi

The BBC micro:bit really makes it easy for you to get hooked and get coding with MicroPython.

Like Python, the micro:bit comes with batteries included. Plug in the battery and an irresistible introductory app launches.

Many newcomers will use the Scratch-like block coding environments. If, like me, you prefer to program in Python, a couple of clicks on the micro:bit website will show you how to upload and run your own code.

When you connect the the micro:bit via USB, it appears as a removable USB drive and you can just drop your code onto the drive to flash (install) and run your program.

There's a browser-based interface to the compiler, but I'm using the mu editor on the Pi.

That way I can maintain my source files on Github, and I'll be sharing them once I have something useful to show.

I'm hoping to start coding the controller for C2Pi in the next few days.
For now I'm working my way through the great examples available on the micro:bit website and elsewhere.

Here's the mu editor showing a little Python program that shows off the display and the buttons:


and here's what happens when you run it: