A few days ago, Adafruit posted a blog about their new NeoMatrix library.
They don't have any tutorials up, but linked to their github for anyone who just can't wait can go ahead and have a hack at it. So last night I pulled their code, soldered together some 60-LED density individually addressable strips that I had lying around, and had a working LED matrix in no time.
When you download the code from github, you'll see a folder called "examples". Make sure the "examples" folder is in your "Arduino" folder, and is next to the "libraries" folder--NOT inside of "libraries"! If your folders are not in the right place, it will not work.
Next, download these libraries:
and put all of these folders inside of your "libraries" folder. Check the image of my folder structure to make sure yours is similar.
Now it's time to set up your LEDs. The NeoMatrix library gives you several options
for setting up your LED matrix. As you solder your LED strips together, make sure to keep in mind that you'll have to match up the physical configuration of your LEDs and adruino with what you've configured in your code.
Open "examples", and find "matrixtest". Open this file in your arduino IDE.
Near the top of the file, you'll find the line of code that is used to define your matrix object. Here's what mine looks like:
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(5, 7, 3,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGZAG,
NEO_RGB + NEO_KHZ800);
Here's what that code means:
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix( = "build me a new matrix"
5 = "that is 5 pixels wide"
7 = "and 7 LED strips tall."
3 = "I will plug my blue data wire from my LED strips into pin 3 on my arduino."
NEO_MATRIX_TOP + NEO_MATRIX_LEFT = "The beginning of my strip, nearest the arduino, is at the top left corner of my matrix."
NEO_MATRIX_ROWS = "I'm orienting my strips horizontally, not vertically."
NEO_MATRIX_ZIGZAG = "I'm soldering my strips in a zigzag pattern, not a progressive pattern."
NEO_RGB = "My strips have RGB LEDs, not GRB LEDs."
NEO_KHZ800 = "My strips work at 800KHz." (These last two will be on the data sheet for the LED strips you bought.)
Take a look at the picture of my LEDs, and note: