Categories
Computing

Current Project: Microcontroller Language

I’m putting a lot of time into learning and experimenting with languages for Microcontrollers. I’m ‘between jobs’ at the moment, and this seems like an interesting technical space to explore with the available time. I read ‘Crafting Interpreters‘ over the Christmas holidays, and was inspired to see if I could get the language running on a microcontroller. I’ve also experimented a few times recently with Raspberry Pi Pico’s, and I have been struck by how powerful they are, and how pleasant it is to program them in a dynamic language.

What you see here is a Raspberry Pi Pico wired up to a 4Tronix Led Cube. Power is supplied by a 2.5A Raspberry Pi USB adapter.

The software is an interpreted language based on ‘Lox’ from Crafting Interpreters. I’ve extended the bytecode vm, the compiler and so on to enable access to the gpio pins on the Pico. I’ve ‘hard coded’ a PIO image in to drive the WS2812 leds on a GPIO pin.

The 4Tronix Cube supplies a 40-pin connector for the ‘classic’ Raspberry Pi computers (I started experiments with this using a Pi Zero). This is jumpered across to power the Pico, and connect the ‘WS2812’ LED string to GPIO 18. The breadboard hosts a zener diode in the power line (so you can plug in USB to the Pico without issue), and a reset button for the pico.

I’m calling my language Yarg (for now), after the Cornish cheese. It seems a nice small name, and food related like Lox. I enjoy the cheese!