We have example code ready to go for these displays. It does not work with every board out there. See the “Compatible Hardware” lists on the opening page for guidance.
Support for 32-bit microcontrollers — M4, RP2040, ESP32, etc. — is documented in a different library called Protomatter, documented here.
Arduino Uno support is limited to the 32x16 matrix, and only “single-buffered” (i.e. no smooth animation), despite any comments in the examples that might suggest otherwise.
Over time, RAM required by the core Arduino code and the matrix-driving graphics libraries has increased…a few bytes here and there as bugs are fixed and features are added. Early on, 32x32 (or double-buffered 32x16) just barely fit in the Arduino Uno’s RAM, with a few dozen bytes to spare for user code. This is no longer the case. But you might still see references to this in older code.
Some libraries need to be downloaded and installed: first is the RGB Matrix Panel library (this contains the low-level code specific to this device), then the Adafruit GFX Library (which handles graphics operations common to many displays we carry) and Adafruit BusIO.
Both libraries can be found and installed using the Arduino Library Manager (Sketch→Include Library→Manage Libraries…). Search for “gfx” and “rgb matrix panel” and install the corresponding Adafruit libraries.
Now you are ready to test! Open up the IDE and load File→Examples→RGBmatrixPanel→testcolors_16x32 (for the 16x32 panel) or File→Examples→RGBmatrixPanel→colorwheel_32x32 (for the 32x32 panel). There’s also a testshapes_32x64 example for boards with sufficient RAM.
If using an Arduino Mega 2560, in addition to wiring changes previously mentioned, you'll need to make a small change to each of the example sketches. This line:
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define CLK 11
(Any of digital pins 10-13 and 50-53 can be used for this function on the Mega, with the corresponding wiring change. The examples all reference pin 11.)
If using an Adafruit Metro M4 (not M0 or 328), the CLK change would instead be:
#define CLK A4
or, with the 32x32 panel:
The most useful line to look at is:
matrix.drawPixel(x, y, matrix.Color333(r, g, b));
Now we can open up the next example, which shows the rest of the library capabilities.
Text editor powered by tinymce.