Datasheet

Here’s how to run one of the examples — a rotating colored square. Because this code is performing low-level
hardware operations, it must be run using the sudo command:
sudo ./demo -D0 --led-rows=32 --led-cols=16
That’s for a single 32x16 pixel RGB matrix. If you have a different size, change the --led-rows and/or --led-cols values.
Add a --led-chain value if multiple matrices are chained.
There are 12 different examples in the demo program (0 through 11), chosen with -D . For a full list of the program’s
options, just type demo .
Depending on your matrix type and Raspberry Pi model, some additional options may need fine-tuning:
--led-slowdown-gpio= (0…2) Sometimes needed to “throttle back” the speed when using a fast Pi with a slower panel.
Default is 1.
--led-rgb-sequence= (RGB order) Some LED matrices may have their red, green and blue LEDs wired up in a different
order…for example, if you need to swap the green and blue channels, use --led-rgb-sequence=RBG . Default is RGB .
--led-pwm-bits= (1…11) For long matrix chains you’ll probably need to use fewer PWM bits, sacrificing some color fidelity
to improve refresh speed. Default is 11 .
There are still many additional options but they’re increasingly esoteric and might only be needed with RGB matrices
from other sources. For a complete explanation of these options (and a more in-depth explanation of the options
above) see the documentation accompanying hzeller’s code repository (https://adafru.it/kdg).
The demos kinda run, but I’m seeing weird rectangles and glitches.
If your Pi is overclocked, or if you’re using a Raspberry Pi 2, you may need to dial back the matrix control speed
slightly. This can be done with the --led-slowdown-gpio=2 setting. Conversely, early Raspberry Pis (Model A, B and
similar) might get an improved image by speeding up the matrix code with a value of 0 here.
There are a few additional examples in that directory showing how to write C++ programs to draw to the matrix. Look
through the source code and Makefile to see how this is done and how to link with the rgbmatrix library. And there’s
more documentation in the hzeller repository (https://adafru.it/BhV), including initializing the matrix size and chain
length in your code so it’s not necessary to specify this on the command line every time.
Using the Python Library
Some Python examples are included in the rpi-rgb-led-matrix/bindings/python/samples directory. The matrix installer script
has already loaded the prerequisite Python Imaging Library and installed the rgbmatrix module for both Python 2.7 and
Python 3.
Again, more documentation is available in the library author’s repository (https://adafru.it/BhW), and some of the
examples show how to specify the matrix size and chain length in code rather than command-line selections every
time.
While the rgbmatrix module provides its own drawing operations, it can also work with the Python Imaging Library as
an “offscreen canvas” that’s then issued to the matrix with the SetImage() or SwapOnVSync() function — see the
examples with “image-” in their name.
Core PIL image functions are explained here: The Image Module (https://adafru.it/dvE)
© Adafruit Industries https://learn.adafruit.com/adafruit-rgb-matrix-plus-real-time-clock-hat-for-raspberry-pi Page 33 of 39