LED RGB matrix and use of arrays

Hi everybody,

I'm fairly new to using an arduino, and to programming in general, so I'm sorry if this is a silly question. Though I am quite proud that I've made a lot of advancement in this area over the last few months. But I've looked on the forum here, and found no answer to this question.

I've recently bought a 32x16 RGB LED matrix from adafruit. A step up from my 8x8 red matrix.
And I have found little problems in using the standard library: Printing and scrolling texts, printing squares, circles, and so on. But now I wanted to draw on it.
So, though it seems a bit messy and a lot of work and memory for a simple task, I started like this:

First, I make an array of the pixels that I want in green.
Like

int plus[5][5]{
{0,0,1,0,0},
{0,0,1,0,0},
{1,1,1,1,1},
{0,0,1,0,0},
{0,0,1,0,0}};

then I clear the screen with the standard line, and i set up two for loops, to check if it should be green or not. Like this:

for (int y=0; y<16; y++){
for (int x=0; x<31; x++){
if (plus[y][x]==1)
{matrix.drawPixel(x, y, matrix.Color333(0,1,0)); }
}}

So, when I get the typo's out, and make sure syntax is correct (which it often isn't) this still doesn't work.
Can anyone explain why?

Check your premises:
Confirm, by using Serial.print, the value of the element ("klaver" vs "plus" ?) that you're testing.

Thanks for the reply, runaway pancake.
That 'klaver' part was a typo... just copied/pasted the for loop from my original, without editing for the rest. I've corrected that now. In my original code, both the array and reference in the loop were called 'klaver' but for here, I thought there was no sense in making such a long array.

I've corrected that now.

And introduced other errors.
Just use the "copy for forum" option in the IDE and past it into the reply box.

int plus[5][5]{
{0,0,1,0,0},
{0,0,1,0,0},
{1,1,1,1,1},
{0,0,1,0,0},
{0,0,1,0,0}};

for (int y=0; y<5; y++){
for (int x=0; x<5; x++){
if (plus[y][x]==1)
{matrix.drawPixel(x, y, matrix.Color333(0,1,0)); }
}}

okay... sorry... I see it becomes a mess when I paste it here, but it did look like decent code in the IDE and when previewing. I don't know why.

I don't know why.

Because you are not doing what you were told.

Please read this:-
How to use this forum

This isn't the last word in rows and columns, but it illustrates the point/s:

byte matrix1 [8][8] =
{
  {1,1,1,1,1,1,1,1},
  {1,1,0,0,0,0,0,0},
  {1,1,0,0,0,0,0,0},
  {1,1,0,0,0,0,0,0},
  {1,1,0,0,0,0,0,0},
  {1,1,0,0,0,1,1,1},
  {1,1,0,0,0,1,1,1},
  {0,0,0,0,0,1,1,1}
};
 
byte matrix2 [8][8] =
{
  {1,1,1,0,0,0,0,0},
  {1,1,1,0,0,0,1,1},
  {1,1,1,0,0,0,1,1},
  {0,0,0,0,0,0,1,1},
  {0,0,0,0,0,0,1,1},
  {0,0,0,0,0,0,1,1},
  {0,0,0,0,0,0,1,1},
  {1,1,1,1,1,1,1,1} 
};
byte row;
byte column;

void setup ()
{
  Serial.begin(9600);
}
void loop ()
{
  for (row = 0; row < 8; row++)
  {
    for (column = 0; column < 8; column++)
    {
      if (matrix1[row][column] == 1)
      {
        Serial.print("X");
      }
      else
      {
        Serial.print(" ");
      }
    }
    Serial.println("");
  }

  Serial.println("");
  Serial.println("");
  delay(1000);

  for (row = 0; row < 8; row++)
  {
    for (column = 0; column < 8; column++)
    {
      if (matrix2[row][column] == 1)
      {
        Serial.print("X");
      }
      else
      {
        Serial.print(" ");
      }
    }
    Serial.println("");
  }    
  
  Serial.println("");
  Serial.println("");  
  delay(1000);
}

Grumpy_Mike:
Because you are not doing what you were told.

Please read this:-
How to use this forum

Grumpy_Mike:
Because you are not doing what you were told.

Please read this:-
How to use this forum

Well, actually, I did exatly what I was told. I clicked 'copy for forum' and pasted that here.
But...
By now, I've got it figured out.
It seems, the code I amde for here (since I threw away the original) did work...
So I experimented some more, and apparently, as long as there are no more than 15 rows in my array, it works.

Lexus77:
Well, actually, I did exatly what I was told. I clicked 'copy for forum' and pasted that here.

But did you actually read the instructions? The ones about "code" tags when you paste code into a submission?

Do please read the instructions, then go back and modify your previous posts (use the "More --> Modify" option to the bottom right of the post) to mark up the code as such so it is displayed correctly.