(fixed post) I want to store 2d shapes for my 8x8 matrix... but in an *array*

Hello all... A programming question:

I bought an 8x8 matrix for my arduino. Fun to play with.

In the example script that comes with it, they use these separate 2d arrays to store little images you might want to display... example:

static const uint8_t PROGMEM
smile_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10100101,
B10011001,
B01000010,
B00111100 },
neutral_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10111101,
B10000001,
B01000010,
B00111100 },
frown_bmp[] =
{ B00111100,
B01000010,
B10100101,
B10000001,
B10011001,
B10100101,
B01000010,
B00111100 };

----> and then to DISPLAY one of those little images, you say something like:

matrix.clear();
matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_ON);
matrix.writeDisplay();

... BUT... what I would really love to do is to have an ARRAY of those two-dimensional arrays, so that instead of having to have separate statements like drawbitmap(0,0,smile_bmp...), I could instead simply have one more argument that would specify like drawbitmap (0,0,4...) for the fourth image or drawbitmap (0,0,9...) for the 9th one, etc.

Of course I realize that an array of two-dimensional arrays is logically a 3-dimensional array. BUT, it's simply that after fiddling with syntax and so forth, I simply couldn't get it to work without errors etc.

---> Can someone tell me how one could set up that first long series of bitmap definitions but doing so so that the first was being called ... ,0, ... and the second was being defined as ,1,... and so forth... so that later on I could do For loops that would simply scan through images, etc?

THANKS for any assistance! [sorry for editing, my first post got posted when I was 5% done with writing.]

Yes.

jremington:
Yes.

sorry, my original post went up with almost no content and just my luck, it got plenty of views while I was fixing it... any thoughts on the question as I've fixed it? thx

Thanks much. I will go back and try that again.

I did try to make a 3-dimensional array to solve this drawBitmap problem a few weeks ago, but the results made me think that something about how this was placed into PROGMEM, and called up using "matrix.drawBitmap," made it so that I was wrong to assume that I could just use the 3-dimensional array methods normally.

But I can't recall the exact errors I was getting, so I'll give it another look.

Eric

const uint8_t *images[] = {smile_bmp, neutral_bmp, frown_bmp};
matrix.drawBitmap(0, 0, images[0], 8, 8, LED_ON);  // Smile
matrix.drawBitmap(0, 0, images[1], 8, 8, LED_ON);  // Neutral
matrix.drawBitmap(0, 0, images[2], 8, 8, LED_ON);  // Frown

Wow! OK, that was a way of doing it that I hadn't thought about ... but it sure looks like it would simplify things for me ... It looks like I just create that one sort of "intermediary" array. and I guess that is an array of pointers? Anyway I will try it...

This world is deep, I am just a simple person...

Huge thanks

Eric

estephan500:
It looks like I just create that one sort of "intermediary" array. and I guess that is an array of pointers?

Yes, an array of pointers.