The examples in this guide are no longer supported. Please check out the Introducing Adafruit Trellis guide for CircuitPython and Python usage:
The Trellis python library has exactly the same API as the Arduino library so it should be familiar and straightforward to use with existing Trellis code. For an example of how to use the library, look at the file in the examples folder of the Trellis library download. This file is a direct port to python of the TrellisTest sketch from the Arduino library.

The only major changes in the Trellis python library are the following:
  • The Adafruit_Trellis and Adafruit_TrellisSet class begin() functions take both an I2C address and bus number, instead of just an address.
  • The Adafruit_TrellisSet class can support any number of Trellises instead of being limited to only 8. Note that each I2C bus is still limited to only 8 Trellises, however by using multiple buses you can control any number of Trellises.
When you run your python script that uses the Trellis library, make sure to run as root using the sudo command or else you might not have access to the I2C hardware.

If you discover issues or want to contribute, please check out the library's github page.

This guide was first published on Feb 13, 2014. It was last updated on Feb 13, 2014.

This page (Usage) was last updated on Apr 17, 2021.

Text editor powered by tinymce.