boids algorithm on pi pico
I have been exploring the raspberry pi pico and it’s rp2040 processor quite a bit. I came across the lectures from Cornell’s Digital Systems Design Using Microcontrollers where the instructor assigns a project to implement boid’s algorithm on the pico. I thought that if designed right - it would look like a very cool desk piece. Here’s what I came up with:
Since I did use code from the cornell course - I am opting to not post the source code. Some details about it though:
- I use one core for drawing the screen and reading encoder input; the other core is doing the boid calculations.
- The course gives a psuedo threading library called “protothreads” by Adam Dunkel which I found fascinanting. It essentially leverages c preprocessor statements to wrap function internals with switch statements so you can maintain your place in the function after yielding. Neato.
Once I had the firmware working - I had to design an enclosure: