Trying to figure out a byte/object/array thing... (possibly a very simple)

I purchased a BlinkM recently (so cool!). It had great example sketches, but I would love some help understanding a snippet of it (or my revised version anyway).

This works...

byte colorPattern[][3] = {
  { 0x00, 0x00, 0x00 }, //black
  { 0xff, 0xff, 0xff } //white

But when I try to edit it later...

colorPattern[][3] = {
  { 0x00, 0x00, 0xff }, //blue
  { 0x00, 0x00, 0xcc } //blue dim

Compile error:

expected primary expression before ']' token

What am I doing wrong?
What IS THAT? I'm not quite connecting the array/object looking byte variable. :[

Thanks for the feedback in advance. :slight_smile:

If you are trying to re-initialize the array after you have already defined it, the compiler doesn't like that. Instead, you would have to do something like:

colorPattern[0][0] = 0x00;
colorPattern[0]1] = 0x00;
colorPattern[0][2] = 0xff;
colorPattern[1][0] = 0x00;
colorPattern[1]1] = 0x00;
colorPattern[1][2] = 0xcc;

You can only use an initializer list at the time the array is defined. After that, you must use assignments.

Aha! That makes more sense and gives me the clues needed to continue. I'll redefine a deeper multidimensional array to start and go from there.

Thanks much!