8x16 led matrix

hello, i am knew to arduino and programming, although i am good with wiring and things like that. i got this example code online for an 8x8 matrix, and i have (attempted to) modified it so that it has 16 columns and 8 rows. i am using an arduino mega, two 8x8 led matrices(direct drive) and i have the row pins linked to each other, row pin 1 linked with 1, 2 linked with 2, and so on. so far, all that is happening is that all of the led are lighting up. if anyone could look at the code that would be great, thanks.

i have included the code as a .ino file

help.ino (4.91 KB)

``````// pin[xx] on led matrix connected to an on Arduino (-1 is dummy to make array start at pos 1)
int pins[25]= {-1, 45, 41, 50, 48, 39, 44, 43, 49, 53, 46, 42, 47, 52, 51, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22};

// col[xx] of leds = pin yy on led matrix
int cols[16] = {pins[52], pins[50], pins[48], pins[46], pins[44], pins[42], pins[40], pins[38], pins[36], pins[34], pins[32], pins[30], pins[28], pins[26], pins[24], pins[22]};
``````

Please explain to me why (in the first element of the “cols” array) you are trying to use the 53rd element of the “pins” array, when the “pins” array clearly only has 25 elements?

What you are doing is this…

``````[0][1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][22][23][24][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?][?] <-- I want that one (a random, undefined place in ram)
``````