When mu is not enough...

I'm working on a micro:bit project book at the moment, and the current chapter covers a Quiz runner application.

It needs multiple micro:bits. For testing I need at least three, one for the Quiz runner and one for each of two competing teams.

Although the micro:bits have different roles, they are all running the same software. The Quiz runner identifies her micro:bit by pressing button A; her micro:bit then sends a radio invitation for the other micro:bits to check in, team by team.

From then on each micro:bit knows its role and can behave appropriately.

 

Mu and PyCharm

 

I normally use Nicholas Tollervey's excellent mu editor for MicroPython development, but the Quiz runner program is more complex than most.

I am using Git to commit versions as the development progresses. Mu's minimalist design makes it very easy to learn. To keep it simple it has no integration with version control applications like Git, so I am using JetBrains' PyCharm.

A few weeks ago I started using a micro:bit plugin for PyCharm which allows me to develop and deploy to a micro:bit. That means I can use PyCharm's integration with Git and GitHub to keep track of the code as I develop it.

 

uflash and the micro:bit

 

The Pi farm programming multiple micro:bits
PyCharm with the plug-in lets me deploy code to a single micro:bit but this particular application requires me to deploy the same code to three or more micro:bits whenever the code changes.

I'm using Nicholas' uflash for that. uflash ( pronounced microflash) can transfer files from a laptop, desktop or Raspberry Pi to an attached micro:bit. I have written a very short shell script which I run on my desktop development environment.

It uses scp and ssh to copy a Python file to two or more Raspberry Pis and then run a uflash command to install that file on each micro:bit. If you need to install software to multiple micro:bits (perhaps for a workshop or class) it's a real time-saver.

If you want to follow progress on the micro:bit project book, subscribe to my free Physical Computing newsletter. You can sign up here.



Comments

Popular posts from this blog

Controlling a Raspberry Pi Pico remotely using PySerial

Five steps to connect Jetson Nano and Arduino

Raspberry Pi Pico project 2 - MCP3008