I'm using an Arduino Uno with this amazing 32x32 LED Matrix board & driver from Adafruit (product #607):
I need to show a fast animation with icons that fill the screen and are displayed in a random order, but the method I'm using isn't working.
I was planing to use the matrix.drawPixel method that's part of the Adafruit library and create a series of arrays that represent the pixels for each icon. In other words, for 10 icons, I would have 10 arrays with 1024 elements each. I would then parse the array into 32 rows and columns.
Here's what an example array would look like:
const int icon1[]={
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1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,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0,*
* 0,0,1,0,1,1,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0,0,*
* 0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,0*
};
And here's how I am parsing and displaying it:
void loop() {
* for(int i=0;i<1024;i++){*
* int horiz = i%32;//find the H position*
* int vert = round(i/32);//find the V position*
_ if(icon1 == 1) {
* matrix.drawPixel(horiz, vert, matrix.Color333(7, 0, 0));//if this is a "1" light up a pixel, otherwise do nothing*
* }
}*_
* delay(500);*
* matrix.fillScreen(matrix.Color333(0, 0, 0));//clear the screen*
* delay(500);*
}
[/b]
What's happening is that this code is working for up to 64 elements in one array, and if I try to read any more than that the program doesn't load at all and I get a blank screen.
Any thoughts on what might be going on? (I'm thinking perhaps it's a memory issue?)
Any suggestions for a different way to do this?
Thanks in advance!