I've been programming in Python for quite a while but have only dabbled in MicroPython. Today I decided to take a Trinket M0 for a test drive and check out Adafruit's version of MicroPython: CircuitPython!
I had an 8x8 Adafruit Bicolor LED Square Pixel Matrix sitting on my desk, and thought it would be fun first CircuitPython project.
It is just unbelievably easy to get up and running with CircuitPython on the Trinket M0. Adafruit has a great guide to get you started, but I will share a few highlights.
The neat thing about the Trinket M0 is that the device shows up as a disk on your machine. So you can add/remove files directly on the device. One slight downside with the Trinket M0 is that it does not have a lot of memory on it, so you should plan on deleting any libraries you don't need. In this case, we deleted the NeoPixel library since we would not be using it.
Adafruit has a bundle of libraries for CircuitPython already compiled. I was quite pleased to find a HT16K33 library has been built, which made my project quite simple. To run this library, I also needed to instal the Adafruit_Bus_Device library. You just copy the directories from the bundle that you need into /lib on your Trinket M0. If there isn't enough space, simply delete any libraries you are not using. You can also delete the README.txt file and the Windows 7 driver (if you are on a Mac or Linux machine).
Once I had the files on the device, I found some example code on Adafruit's GitHub page. With the Bicolor matrix, I simply had to uncomment the line for matrix.Matrix8x8x2
Now comes the fun part! I simply saved the code I created as "code.py" in the root directory of the Trinket M0 and it executed right away!
The example code was cool, but I thought a smiley face would be even better
To create this, I needed to know which locations on the matrix to light up. A handy way to do this is in Excel or Google Sheets:
So now I know I need to light up (0,1) (0,2) (1,1) (1,2), etc...
And here is the result! Note that the 3rd number in each line denotes the color: green is 1, red is 2.
Comments will be approved before showing up.