TLDR

If you just want to play and not read the words you can find swarm here.

Pre(r)amble

I’m a huge fan of the micro:bit radio. The API is simple and really nicely designed, and you can get started with it if you’re a complete novice to programming in a few minutes and make a simple beacon, progressing to building remote controls after a surprisingly short time. Our 8 year old created her own remote control for a robot I designed for her in an afternoon after doing two radio themed tutorials in Makecode.

Whilst I do really like both the Makecode and Micropython simulators for the micro:bit, I don’t really love how simulation works with the radio. Writing some radio code with Makecode will spawn a second micro:bit with identical code, which is great for being able to demonstrate the principle but not great for getting students to design independent programs that communicate with each other.

In a previous job I spent a lot of time thinking about “but what if students don’t have access to $RESOURCE?” and scaffolding learning material through simulation to try and get to the point where a student could learn the concepts without access to devices or software, but had to work within the confines of an organisation where people who maintained the platform had (quite reasonable) opinions about complexity and technical debt.

But now I have “helpful coding agents” and no product manager or devs to argue with me 🤪🥳

Itty :Bitty Swarm

From the Department of This Sounds Like a Cool Idea comes Swarm Canvas (github), which is a way to drop in micro:bit code (either Makecode, Micropython, or a mix of both) .hex files for different programs and have them play together. They can send each other radio messages, print output to serial, and receive sensor data from things like configurable light and sound sources.

You can interact with the micro:bit devices, pressing their buttons and dragging them around and see how they respond to different scenarios, save and load layouts, and generally have a good time. This all runs client-side in the user’s web browser - no logins, no server code, just hosting.

Some batteries not included

Just because I don’t have a product manager anymore doesn’t mean everything is in the box. You intentionally can’t edit code in the sim, and classes of events that I think would make the UI too complex like the accelerometer and gestures are not included. Also sound - I know what a classroom full of students “accidentally” making cats meow in Scratch is like.

Here’s a simple demo with two Makecode programs. One is a light sensor that transmits light levels over radio, the other takes the radio values and graphs them on its display.

If this also sounds like a good idea and you want to share any interesting uses, let me know (rob at here). If it almost scratches an itch, but doesn’t quite get there, let me know too.

Blah blah blah

I’m one person testing ideas that fall out of my head. There will be edge cases I haven’t considered, not production software etc etc. If there are ideas or broken things you care about, gather some detail and either drop in an issue or an email and I’ll see what I can do.

Sorta technical stuff

This project runs both Makecode and Micropython simulators as needed, and there’s occasionally some funky stuff going on behind the scenes to make them behave in a consistent manner. For example, Makecode exposes three different radio events receive number, receive text, and receive name = value, whereas Micropython doesn’t care about any of that. There are some heuristics going on behind the scenes to try and make those play nicely together that might have some breaking scenarios.

The sim normalises some values so that both Makecode and Micropython programs get consistent data. While I’ve tried to make the sim act roughly the way it would if you loaded the code onto real devices, there are probably some compromises that got made that make the sim and real life a bit out of whack. Linear sound levels are one of them, but I’ve also got magnets sitting behind a feature flag at the moment because I’m not confident I understand magnetism well enough and haven’t done enough testing to trust the implementation the agent built out.