Velleman VM207 User Manual - page 15
15
K8403
USER MANUAL
// Example for NeoPixel Shield. In this application we’d like to use it
// as a 5x8 tall matrix, with the USB port positioned at the top of the
// Arduino. When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order. The shield uses
// 800 KHz (v2) pixels that expect GRB colour data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(5, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
The first part includes all 3 libraries (NEOPIXEL, NEOMATRIX and GFX).
Next we will define an output pin again. This is the same principle as in the previous chapter.
And now we have a comment section where will be explained how to configure the library, so it knows
how your panel assembly looks like. First we will give a name to our panel, in this case:”matrix”. Then
there are 5 parameters that you need to take care of:
• width of your matrix (number of LEDs that span the width of your matrix (8, 16, 32, ...)
• height of your matrix (number of LEDs that span the height of your matrix (8, 16, 32, ...)
• PIN number of the data output pin.
• This parameter describes the layout of the panel assembly and is made out of flags that you need
to add together. First you need to specify where the first LED in the matrix sits. Mostly this is in the
top left corner so this should be: NEO_MATRIX_TOP + NEO_MATRIX_LEFT. Then you need
to choose wether the LEDs are chained in rows or columns. If you use the panels horizontally, you
need to choose: NEO_MATRIX_ROWS. Then you need to choose wether the rows (or columns)
are progressive or zigzagged, with the VM207 this is ALWAYS progressive so this becomes: NEO_
MATRIX_PROGRESSIVE.
• The last parameter is about what LEDs you use with the VM207, this is ALWAYS: NEO_GRB +
NEO_KHZ800.
So all these parameters need to be put together as follows to drive 1 panel, for example (you will need
to alter the code from the example to the following code as this is made to drive an 5 x 8 panel with dif-
ferent properties):
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
If you ever build a bigger display out of VM207 panels you just need to think of it as one big panel and
adjust the parameters accordingly.
The following code in the program is just an array with 3 colours so we can cycle through some colours
to make the example a bit more special: