Categories
Computing

Day 8 – Box 3, working

For Day 1, go here. The series is tagged advent-2025.

A second post for Day 8. Now that I have Yarg 0.3.0 in hand, I can get box 3 working. Press the red button, see the red LED light. Press the green button, see the green (onboard) LED light.

The code, as before, is in the box3 subdirectory. We need to add the rgbutton.ya file to the standard Yarg image:

$ cp ../yarg-lang-pico-0.3.0/yarg-lang-pico-0.3.0.uf2 box3.uf2

$ hostyarg addfile -fs box3.uf2 -add rgbutton.ya

$ picotool load box3.uf2

That sequence assumes the Pico is waiting as the RPI-RP2 usb drive after booting with bootsel held down.

After flashing completes, reboot the pico (eg with picotool reboot), and at the serial prompt from the Pico:

> import("rgbutton");

We could name the file main.ya to get it to start automatically when the pico reboots.

The code illustrates a key point about Yarg – the hardware driver code is all Yarg, so can be extended at will. In this case, the GPIO library did not include a method (yet!) to setup the pull-up resistors, so I added gpio_set_pulls right in rgbutton.ya.

Categories
Computing

Day 8 – Yarg 0.3.0

For Day 1, go here. The series is tagged advent-2025.

Day 8 in advent-land, and I have today and/or tomorrow to complete the calendar within my own self-imposed deadline (it depends on whether you count Christmas Day as one of the twelve days or not…)

Clearly I will miss that – I underestimated the work involved in being host this Christmas. It was awesome to do that, and share Christmas with so much of my family and friends. Thanks to hosts from previous years, all over again!

In fairness, I was also stalled by a bug I uncovered in the interrupt handling routines for Yarg, so today is a release that fixes that:

Yarg 0.3.0

As well as the bugfix, it ships a lot of the device code I’ve been using, and LED drivers for both WS2812 and AP102 LEDs. I used those for the tree.

Happy New Year!