Skip to content
Circuit Python + Adafruit Trinket M0 + BiColor 8x8

Circuit Python + Adafruit Trinket M0 + BiColor 8x8

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.

  • Updating your Trinket M0 to the latest firmware is always a good place to start
  • Make sure you install the latest version of the Mu editor, which makes working in CircuitPython a breeze.  If you have an old version of Mu, be sure to delete it.  In my case, I had an older version of Mu that was setup only for a Micro:Bit.  In the latest version, you can select what flavor of MicroPython you wish to use (Circuit Python, MicroBit, or Python 3)
  • It is always good to start by installing some example code...the proverbial "make the light blink"  I always tell people, once you get the light to blink, you can do anything.  

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 "" 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.



Previous article Raspberry Pi Reseller Conference
Next article Raspberry Pi Authorized Reseller

Leave a comment

Comments must be approved before appearing

* Required fields

Compare products

{"one"=>"Select 2 or 3 items to compare", "other"=>"{{ count }} of 3 items selected"}

Select first item to compare

Select second item to compare

Select third item to compare