Introduction
This is the documentation for Adafruit's RGB LED Matrix Panel library for the Arduino platform. It is designed to work with 16x32, 32x32 and 32x64 panels.
A few notes on the implementation:
- To control LED brightness, traditional PWM is eschewed in favor of Binary Code Modulation (aka Bit Angle Modulation), which operates through a succession of periods each twice the length of the preceeding one (rather than a direct linear count a la PWM). It's explained well here. I was initially skeptical, but it works exceedingly well in practice! And this uses considerably fewer CPU cycles than software PWM.
- Although many control pins are software-configurable in the user's code, a couple things are tied to specific PORT registers. It's just a lot faster this way – port lookups take time. Please see the notes later regarding wiring on "alternative" Arduino boards.
- A tiny bit of inline assembly language is used in the most speed- critical section. The C++ compiler wasn't making optimal use of the instruction set in what seemed like an obvious chunk of code. Since it's only a few short instructions, this loop is also "unrolled" – each iteration is stated explicitly, not through a control loop.
- The library is stuck with some decisions that were made in the heyday of 2K RAM AVR microcontrollers. For newer projects on SAMD, ESP32 and other 32-bit devices, consider using Adafruit_Protomatter instead, which offers more flexible support of size and color depth.
Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!
Dependencies
This library depends on Adafruit_GFX being present on your system. Please make sure you have installed the latest version before using this library.
Author
Written by Limor Fried/Ladyada & Phil Burgess/PaintYourDragon for Adafruit Industries.
License
BSD license, all text here must be included in any redistribution.