setting up a 2 dimensional array with RGB values


code: [select]
int black[4] = {0, 0, 0, 0};
int white[4] = {0, 0, 0, 100};
int red[4]   = {100, 0, 0, 0};
int green[4] = {0, 100, 0, 0};
int blue[4]  = {0, 0, 100, 0};
int yellow[4] = {40, 95, 0, 0};
int purple[4] = {50, 0, 100, 0};

can this, , this?
code: [select]

int colors[][4] = {black[]}, {white[]};


this doesn't work, close, or have list values directly in line initiate colors[]?
i'd them can loop thru colors, this:

int colorcount = 7;
for (int = 0; < colorcount; i++) {
display(colors);
i += 1;
}

quote
can this
obviously.

quote
and this?
no.

why need array of arrays? not same 2d array. want? array of pointers arrays 1 way. read 2d array another.

code: [select]
int colorcount = 7;
for (int = 0; < colorcount; i++) {
display(colors);
i += 1;
}

i' code doesn't that. and, know why expect use code tags.


Arduino Forum > Using Arduino > Programming Questions > setting up a 2 dimensional array with RGB values


arduino

Comments