# 8x8 Matrix Coding question

So heres the deal. I have a LED matrix that I made and I’m trying to save a bit of space as I’m already using two thirds of my space. A large part of the problem is a library (not actually a library because its in my main file) of basically bitmaps that I use for letters. I have it set up with 1’s and 0’s but they are integers so still using more space than needed. Here’s what each one looks like:

``````void A(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,1,1,0,0,0);
setRow(3, 0,0,1,0,0,1,0,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,1,1,1,1,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}
``````

setRow is a function that sets a array to those numbers before it gets displayed, see other code.

I want to change each of my characters to an array with 8 bytes and then make a function that can be feed a certain array and write each of the bits to its on spot in my arrays. This will cut down I estimate around 5000 byte of space which would be awesome.

Here is the way I want to change it to:

``````byte A[] = {
B00000000,
B00011000,
B00100100,
B01000010,
B01111110,
B01000010,
B01000010,
B00000000
};
``````

This is great except that I don’t know an efficient way to look at each item in the array, then do the bitRead function on it and assign that to its on position on the matrix. If it was just one byte it would be easy you just send it the byte and it does something like

``````a = (desired byte);
``````

But that would only work for on one row and not all 8. What I think would be best would be if I did it all in one fell swoop like this:

``````writeLetter(byte A[]){

for (int count = 1; count < 9; count++){
}
}
``````

Obviously the problem with this is I’m trying to pass an array through a function which you cant do. I feel like what I need is a pointer but I am still not good with pointers so I’m not sure how to do that.

If anyone can help me out with this function It would be great.

All of my code is below if you are wondering what something does. Go ahead and use it for your matrix if your looking to do the same thing. All you have to do is hook up your anodes and cathodes to the arduino, no shift registers or anything.

``````int anodeArray[] = {6, 7, 8, 9, 10, 11, 12, 13};   // the output enables for each individual led
int cathodeArray[] = {2, 3, 4, 5, A5, A4, A2, A3};   // the output enables for each individual led
int randomArray[] = {0,0,0,0,0,0,0,0};

int on1[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on2[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on3[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on4[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on5[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on6[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on7[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};
int on8[] = {0, 0, 0, 0, 0, 0, 0, 0,      0, 0, 0, 0, 0, 0, 0, 0};

void setup(){
for (int count=2; count < 14; count++){
pinMode(count,OUTPUT);
}
pinMode(A5,OUTPUT);
pinMode(A4,OUTPUT);
pinMode(A3,OUTPUT);
pinMode(A2,OUTPUT);
}

int pinsLow(){
for (int count=0; count < 8; count++){
digitalWrite(anodeArray[count], LOW);
digitalWrite(cathodeArray[count], HIGH);
}
}

/*writeLetter(byte A[]){

for (int count = 1; count < 9; count++){
}
}

int BINwrite(int a){

byte b = byte(a);
for (int i = 0; i < 9; i++) {
digitalWrite(pinArray[i], bit);
}
delay(10);
}
*/

void allOff(){
setCol(1, 0,0,0,0,0,0,0,0);
setCol(2, 0,0,0,0,0,0,0,0);
setCol(3, 0,0,0,0,0,0,0,0);
setCol(4, 0,0,0,0,0,0,0,0);
setCol(5, 0,0,0,0,0,0,0,0);
setCol(6, 0,0,0,0,0,0,0,0);
setCol(7, 0,0,0,0,0,0,0,0);
setCol(8, 0,0,0,0,0,0,0,0);
}

void A(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,1,1,0,0,0);
setRow(3, 0,0,1,0,0,1,0,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,1,1,1,1,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void B(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,0,0,0);
setRow(3, 0,1,0,0,0,1,0,0);
setRow(4, 0,1,1,1,1,0,0,0);
setRow(5, 0,1,0,0,0,1,0,0);
setRow(6, 0,1,0,0,0,1,0,0);
setRow(7, 0,1,1,1,1,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void C(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,0,0);
setRow(5, 0,1,0,0,0,0,0,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void D(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,1,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void E(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,1,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,1,1,1,1,1,0,0);
setRow(5, 0,1,0,0,0,0,0,0);
setRow(6, 0,1,0,0,0,0,0,0);
setRow(7, 0,1,1,1,1,1,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void F(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,1,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,1,1,1,1,1,1,0);
setRow(5, 0,1,0,0,0,0,0,0);
setRow(6, 0,1,0,0,0,0,0,0);
setRow(7, 0,1,0,0,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void G(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,0,0);
setRow(5, 0,1,0,0,0,1,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void H(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,1,1,1,1,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void I(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,0,0);
setRow(3, 0,0,0,1,0,0,0,0);
setRow(4, 0,0,0,1,0,0,0,0);
setRow(5, 0,0,0,1,0,0,0,0);
setRow(6, 0,0,0,1,0,0,0,0);
setRow(7, 0,1,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void J(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,1,0);
setRow(3, 0,0,0,0,0,1,0,0);
setRow(4, 0,0,0,0,0,1,0,0);
setRow(5, 0,0,0,0,0,1,0,0);
setRow(6, 0,1,0,0,0,1,0,0);
setRow(7, 0,0,1,1,1,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void K(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,1,1,0);
setRow(3, 0,1,0,0,1,0,0,0);
setRow(4, 0,1,1,1,0,0,0,0);
setRow(5, 0,1,0,0,1,0,0,0);
setRow(6, 0,1,0,0,0,1,0,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void L(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,0,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,1,0,0,0,0,0,0);
setRow(5, 0,1,0,0,0,0,0,0);
setRow(6, 0,1,0,0,0,0,0,0);
setRow(7, 0,1,1,1,1,1,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void M(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,1,0,0,1,1,0);
setRow(4, 0,1,0,1,1,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void N(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,1,0,0,0,1,0);
setRow(4, 0,1,0,1,0,0,1,0);
setRow(5, 0,1,0,0,1,0,1,0);
setRow(6, 0,1,0,0,0,1,1,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void O(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void P(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,0,0,0);
setRow(3, 0,1,0,0,0,1,0,0);
setRow(4, 0,1,1,1,1,0,0,0);
setRow(5, 0,1,0,0,0,0,0,0);
setRow(6, 0,1,0,0,0,0,0,0);
setRow(7, 0,1,0,0,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void Q(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,1,0,1,0);
setRow(6, 0,1,0,0,0,1,0,0);
setRow(7, 0,0,1,1,1,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void R(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,0,0,0,0);
setRow(3, 0,1,0,0,1,0,0,0);
setRow(4, 0,1,0,0,1,0,0,0);
setRow(5, 0,1,1,1,0,0,0,0);
setRow(6, 0,1,0,0,1,0,0,0);
setRow(7, 0,1,0,0,0,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void S(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,1,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,0,1,1,1,1,0,0);
setRow(5, 0,0,0,0,0,0,1,0);
setRow(6, 0,0,0,0,0,0,1,0);
setRow(7, 0,1,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void T(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,0,0);
setRow(3, 0,0,0,1,0,0,0,0);
setRow(4, 0,0,0,1,0,0,0,0);
setRow(5, 0,0,0,1,0,0,0,0);
setRow(6, 0,0,0,1,0,0,0,0);
setRow(7, 0,0,0,1,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void U(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void V(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,0,1,0,0,1,0,0);
setRow(7, 0,0,0,1,1,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void W(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,1,0,0,0,0,1,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,1,1,0,1,0);
setRow(7, 0,0,1,0,0,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void X(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,0,1,0);
setRow(3, 0,0,1,0,0,1,0,0);
setRow(4, 0,0,0,1,1,0,0,0);
setRow(5, 0,0,0,1,1,0,0,0);
setRow(6, 0,0,1,0,0,1,0,0);
setRow(7, 0,1,0,0,0,0,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void Y(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,0,0,0,1,0,0);
setRow(3, 0,1,0,0,0,1,0,0);
setRow(4, 0,0,1,0,1,0,0,0);
setRow(5, 0,0,0,1,0,0,0,0);
setRow(6, 0,0,0,1,0,0,0,0);
setRow(7, 0,0,0,1,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void Z(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,1,0);
setRow(3, 0,0,0,0,0,1,0,0);
setRow(4, 0,0,0,0,1,0,0,0);
setRow(5, 0,0,0,1,0,0,0,0);
setRow(6, 0,0,1,0,0,0,0,0);
setRow(7, 0,1,1,1,1,1,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}
``````
``````void num0(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,1,1,0);
setRow(4, 0,1,0,0,1,0,1,0);
setRow(5, 0,1,0,1,0,0,1,0);
setRow(6, 0,1,1,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num1(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,0,1,0,0,0);
setRow(3, 0,0,0,1,1,0,0,0);
setRow(4, 0,0,1,0,1,0,0,0);
setRow(5, 0,0,0,0,1,0,0,0);
setRow(6, 0,0,0,0,1,0,0,0);
setRow(7, 0,0,1,1,1,1,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num2(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,1,1,0,0,0);
setRow(3, 0,0,1,0,0,1,0,0);
setRow(4, 0,0,0,0,0,1,0,0);
setRow(5, 0,0,0,0,1,0,0,0);
setRow(6, 0,0,0,1,0,0,0,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num3(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,0,0,0);
setRow(3, 0,1,0,0,0,1,0,0);
setRow(4, 0,0,0,1,1,0,0,0);
setRow(5, 0,0,0,0,0,1,0,0);
setRow(6, 0,1,0,0,0,1,0,0);
setRow(7, 0,0,1,1,1,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num4(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,0,0,1,0,0);
setRow(3, 0,0,0,0,1,1,0,0);
setRow(4, 0,0,0,1,0,1,0,0);
setRow(5, 0,0,1,1,1,1,1,0);
setRow(6, 0,0,0,0,0,1,0,0);
setRow(7, 0,0,0,0,0,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num5(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,1,1,1,1,0,0,0);
setRow(5, 0,0,0,0,0,1,0,0);
setRow(6, 0,0,0,0,0,1,0,0);
setRow(7, 0,1,1,1,1,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num6(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,1,0);
setRow(3, 0,1,0,0,0,0,0,0);
setRow(4, 0,1,1,1,1,1,0,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num7(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,1,1,1,1,1,1,0);
setRow(3, 0,0,0,0,0,1,0,0);
setRow(4, 0,0,0,0,1,0,0,0);
setRow(5, 0,0,0,1,0,0,0,0);
setRow(6, 0,0,0,1,0,0,0,0);
setRow(7, 0,0,0,1,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num8(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,0,1,1,1,1,0,0);
setRow(5, 0,1,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void num9(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,1,1,1,1,0,0);
setRow(3, 0,1,0,0,0,0,1,0);
setRow(4, 0,0,1,1,1,1,1,0);
setRow(5, 0,0,0,0,0,0,1,0);
setRow(6, 0,1,0,0,0,0,1,0);
setRow(7, 0,0,1,1,1,1,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void symbol_(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,0,0,0,0,0);
setRow(3, 0,0,0,0,0,0,0,0);
setRow(4, 0,0,0,0,0,0,0,0);
setRow(5, 0,0,0,0,0,0,0,0);
setRow(6, 0,0,0,0,0,0,0,0);
setRow(7, 0,1,1,1,1,1,1,0);
setRow(8, 0,0,0,0,0,0,0,0);
}

void semicolon(){
setRow(1, 0,0,0,0,0,0,0,0);
setRow(2, 0,0,0,1,1,0,0,0);
setRow(3, 0,0,0,1,1,0,0,0);
setRow(4, 0,0,0,0,0,0,0,0);
setRow(5, 0,0,0,1,1,0,0,0);
setRow(6, 0,0,0,1,1,0,0,0);
setRow(7, 0,0,0,0,0,0,0,0);
setRow(8, 0,0,0,0,0,0,0,0);
}
void display(){
digitalWrite(cathodeArray[0], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on1[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[1], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on2[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[2], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on3[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[3], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on4[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[4], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on5[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[5], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on6[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[6], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on7[count]);
}
delayMicroseconds(100);
pinsLow();

digitalWrite(cathodeArray[7], LOW);
for (int count = 0; count < 8; count++){
digitalWrite(anodeArray[count],on8[count]);
}
delayMicroseconds(100);
pinsLow();

}

void displayFor(int a){
for (int time = 0; time < a; time++){
display();
}
}

void setRow(int a, int b, int c, int d, int e, int f, int g, int h, int i){

switch(a){
case 1:
on1[0] = b; on1[1] = c; on1[2] = d; on1[3] = e; on1[4] = f; on1[5] = g; on1[6] = h; on1[7] = i;
break;

case 2:
on2[0] = b; on2[1] = c; on2[2] = d; on2[3] = e; on2[4] = f; on2[5] = g; on2[6] = h; on2[7] = i;
break;

case 3:
on3[0] = b; on3[1] = c; on3[2] = d; on3[3] = e; on3[4] = f; on3[5] = g; on3[6] = h; on3[7] = i;
break;

case 4:
on4[0] = b; on4[1] = c; on4[2] = d; on4[3] = e; on4[4] = f; on4[5] = g; on4[6] = h; on4[7] = i;
break;

case 5:
on5[0] = b; on5[1] = c; on5[2] = d; on5[3] = e; on5[4] = f; on5[5] = g; on5[6] = h; on5[7] = i;
break;

case 6:
on6[0] = b; on6[1] = c; on6[2] = d; on6[3] = e; on6[4] = f; on6[5] = g; on6[6] = h; on6[7] = i;
break;

case 7:
on7[0] = b; on7[1] = c; on7[2] = d; on7[3] = e; on7[4] = f; on7[5] = g; on7[6] = h; on7[7] = i;
break;

case 8:
on8[0] = b; on8[1] = c; on8[2] = d; on8[3] = e; on8[4] = f; on8[5] = g; on8[6] = h; on8[7] = i;
break;

}
}

void setCol(int a, int b, int c, int d, int e, int f, int g, int h, int i){
on1[a-1] = b;
on2[a-1] = c;
on3[a-1] = d;
on4[a-1] = e;
on5[a-1] = f;
on6[a-1] = g;
on7[a-1] = h;
on8[a-1] = i;
}
``````
``````void shiftUp(int a){

for(int i = 0; i < a; i++){

setRow(1,on2[0],on2[1],on7[2],on2[3],on2[4],on2[5],on2[6],on2[7]);
setRow(2,on3[0],on3[1],on1[2],on3[3],on3[4],on3[5],on3[6],on3[7]);
setRow(3,on4[0],on4[1],on2[2],on4[3],on4[4],on4[5],on4[6],on4[7]);
setRow(4,on5[0],on5[1],on3[2],on5[3],on5[4],on5[5],on5[6],on5[7]);
setRow(5,on6[0],on6[1],on4[2],on6[3],on6[4],on6[5],on6[6],on6[7]);
setRow(6,on7[0],on7[1],on5[2],on7[3],on7[4],on7[5],on7[6],on7[7]);
setRow(7,on8[0],on8[1],on6[2],on8[3],on8[4],on8[5],on8[6],on8[7]);
setRow(8,0,0,0,0,0,0,0,0);

}
}

void shiftDown(int a){

for(int i = 0; i < a; i++){

setRow(8,on7[0],on7[1],on7[2],on7[3],on7[4],on7[5],on7[6],on7[7]);
setRow(7,on6[0],on6[1],on6[2],on6[3],on6[4],on6[5],on6[6],on6[7]);
setRow(6,on5[0],on5[1],on5[2],on5[3],on5[4],on5[5],on5[6],on5[7]);
setRow(5,on4[0],on4[1],on4[2],on4[3],on4[4],on4[5],on4[6],on4[7]);
setRow(4,on3[0],on3[1],on3[2],on3[3],on3[4],on3[5],on3[6],on3[7]);
setRow(3,on2[0],on2[1],on2[2],on2[3],on2[4],on2[5],on2[6],on2[7]);
setRow(2,on1[0],on1[1],on1[2],on1[3],on1[4],on1[5],on1[6],on1[7]);
setRow(1,0,0,0,0,0,0,0,0);

}
}

void shiftLeft(int a){

for(int i = 0; i < a; i++){

setRow(1,on1[1],on1[2],on1[3],on1[4],on1[5],on1[6],on1[7],on1[8]);
setRow(2,on2[1],on2[2],on2[3],on2[4],on2[5],on2[6],on2[7],on2[8]);
setRow(3,on3[1],on3[2],on3[3],on3[4],on3[5],on3[6],on3[7],on3[8]);
setRow(4,on4[1],on4[2],on4[3],on4[4],on4[5],on4[6],on4[7],on4[8]);
setRow(5,on5[1],on5[2],on5[3],on5[4],on5[5],on5[6],on5[7],on5[8]);
setRow(6,on6[1],on6[2],on6[3],on6[4],on6[5],on6[6],on6[7],on6[8]);
setRow(7,on7[1],on7[2],on7[3],on7[4],on7[5],on7[6],on7[7],on7[8]);
setRow(8,on8[1],on8[2],on8[3],on8[4],on8[5],on8[6],on8[7],on8[8]);

on1[8]=on1[9]; on1[9]=on1[10]; on1[10]=on1[11]; on1[11]=on1[12]; on1[12]=on1[13]; on1[13]=on1[14]; on1[14]=on1[15]; on1[15]=0;
on2[8]=on2[9]; on2[9]=on2[10]; on2[10]=on2[11]; on2[11]=on2[12]; on2[12]=on2[13]; on2[13]=on2[14]; on2[14]=on2[15]; on2[15]=0;
on3[8]=on3[9]; on3[9]=on3[10]; on3[10]=on3[11]; on3[11]=on3[12]; on3[12]=on3[13]; on3[13]=on3[14]; on3[14]=on3[15]; on3[15]=0;
on4[8]=on4[9]; on4[9]=on4[10]; on4[10]=on4[11]; on4[11]=on4[12]; on4[12]=on4[13]; on4[13]=on4[14]; on4[14]=on4[15]; on4[15]=0;
on5[8]=on5[9]; on5[9]=on5[10]; on5[10]=on5[11]; on5[11]=on5[12]; on5[12]=on5[13]; on5[13]=on5[14]; on5[14]=on5[15]; on5[15]=0;
on6[8]=on6[9]; on6[9]=on6[10]; on6[10]=on6[11]; on6[11]=on6[12]; on6[12]=on6[13]; on6[13]=on6[14]; on6[14]=on6[15]; on6[15]=0;
on7[8]=on7[9]; on7[9]=on7[10]; on7[10]=on7[11]; on7[11]=on7[12]; on7[12]=on7[13]; on7[13]=on7[14]; on7[14]=on7[15]; on7[15]=0;
on8[8]=on8[9]; on8[9]=on8[10]; on8[10]=on8[11]; on8[11]=on8[12]; on8[12]=on8[13]; on8[13]=on8[14]; on8[14]=on8[15]; on8[15]=0;

}
}

void shiftRight(int a){

for(int i = 0; i < a; i++){

setRow(1,0,on1[0],on1[1],on1[2],on1[3],on1[4],on1[5],on1[6]);
setRow(2,0,on2[0],on2[1],on2[2],on2[3],on2[4],on2[5],on2[6]);
setRow(3,0,on3[0],on3[1],on3[2],on3[3],on3[4],on3[5],on3[6]);
setRow(4,0,on4[0],on4[1],on4[2],on4[3],on4[4],on4[5],on4[6]);
setRow(5,0,on5[0],on5[1],on5[2],on5[3],on5[4],on5[5],on5[6]);
setRow(6,0,on6[0],on6[1],on6[2],on6[3],on6[4],on6[5],on6[6]);
setRow(7,0,on7[0],on7[1],on7[2],on7[3],on7[4],on7[5],on7[6]);
setRow(8,0,on8[0],on8[1],on8[2],on8[3],on8[4],on8[5],on8[6]);

on1[15]=on1[14]; on1[14]=on1[13]; on1[13]=on1[12]; on1[12]=on1[11]; on1[11]=on1[10]; on1[10]=on1[9]; on1[9]=on1[8]; on1[8]=on1[7];
on2[15]=on2[14]; on2[14]=on2[13]; on2[13]=on2[12]; on2[12]=on2[11]; on2[11]=on2[10]; on2[10]=on2[9]; on2[9]=on2[8]; on2[8]=on2[7];
on3[15]=on3[14]; on3[14]=on3[13]; on3[13]=on3[12]; on3[12]=on3[11]; on3[11]=on3[10]; on3[10]=on3[9]; on3[9]=on3[8]; on3[8]=on3[7];
on4[15]=on4[14]; on4[14]=on4[13]; on4[13]=on4[12]; on4[12]=on4[11]; on4[11]=on4[10]; on4[10]=on4[9]; on4[9]=on4[8]; on4[8]=on4[7];
on5[15]=on5[14]; on5[14]=on5[13]; on5[13]=on5[12]; on5[12]=on5[11]; on5[11]=on5[10]; on5[10]=on5[9]; on5[9]=on5[8]; on5[8]=on5[7];
on6[15]=on6[14]; on6[14]=on6[13]; on6[13]=on6[12]; on6[12]=on6[11]; on6[11]=on6[10]; on6[10]=on6[9]; on6[9]=on6[8]; on6[8]=on6[7];
on7[15]=on7[14]; on7[14]=on7[13]; on7[13]=on7[12]; on7[12]=on7[11]; on7[11]=on7[10]; on7[10]=on7[9]; on7[9]=on7[8]; on7[8]=on7[7];
on8[15]=on8[14]; on8[14]=on8[13]; on8[13]=on8[12]; on8[12]=on8[11]; on8[11]=on8[10]; on8[10]=on8[9]; on8[9]=on8[8]; on8[8]=on8[7];

}
}

void scroll(byte a, byte b, int c, int d){
chooseCharacter(b);
shiftRight(d);
chooseCharacter(a);

for (int count = 0; count < d; count++){
displayFor(c);
shiftLeft(1);
}
}

void chooseCharacter(byte a){
switch(a){
case 'A': A(); break;
case 'B': B(); break;
case 'C': C(); break;
case 'D': D(); break;
case 'E': E(); break;
case 'F': F(); break;
case 'G': G(); break;
case 'H': H(); break;
case 'I': I(); break;
case 'J': J(); break;
case 'K': K(); break;
case 'L': L(); break;
case 'M': M(); break;
case 'N': N(); break;
case 'O': O(); break;
case 'P': P(); break;
case 'Q': Q(); break;
case 'R': R(); break;
case 'S': S(); break;
case 'T': T(); break;
case 'U': U(); break;
case 'V': V(); break;
case 'W': W(); break;
case 'X': X(); break;
case 'Y': Y(); break;
case 'Z': Z(); break;
case '0': num0(); break;
case '1': num1(); break;
case '2': num2(); break;
case '3': num3(); break;
case '4': num4(); break;
case '5': num5(); break;
case '6': num6(); break;
case '7': num7(); break;
case '8': num8(); break;
case '9': num9(); break;
case ':': semicolon(); break;
case '_': symbol_(); break;
case ' ': allOff(); break;

}
}
``````
``````void setPixel(int a, int b){
switch(b){
case 0: on1[a] = 1; break;
case 1: on2[a] = 1; break;
case 2: on3[a] = 1; break;
case 3: on4[a] = 1; break;
case 4: on5[a] = 1; break;
case 5: on6[a] = 1; break;
case 6: on7[a] = 1; break;
case 7: on8[a] = 1; break;
}
}

void test(){
for (int count = 1; count < 9; count++){
setRow(count, 1,1,1,1,1,1,1,1);
displayFor(700);
allOff();
}
for (int count = 1; count < 9; count++){
setCol(count, 1,1,1,1,1,1,1,1);
displayFor(700);
allOff();
}

}

void pixelTest(){
for(int i = 0; i < 8; i++){
for(int x = 0; x < 8; x++){
setPixel(i,x);
displayFor(30);
allOff();
}
}
for(int i = 0; i < 8; i++){
for(int x = 0; x < 8; x++){
setPixel(x,i);
displayFor(30);
allOff();
}
}
}

void sinWave(int a){

for (int i = 0; i < 2; i++){
setPixel(0,1); displayFor(a); shiftRight(1);}

for (int i = 0; i < 2; i++){
setPixel(0,2); displayFor(a); shiftRight(1);}

setPixel(0,3); displayFor(a); shiftRight(1);

setPixel(0,4); displayFor(a); shiftRight(1);

for (int i = 0; i < 2; i++){
setPixel(0,5); displayFor(a); shiftRight(1);}

for (int i = 0; i < 3; i++){
setPixel(0,6); displayFor(a); shiftRight(1);}

for (int i = 0; i < 2; i++){
setPixel(0,5); displayFor(a); shiftRight(1);}

setPixel(0,4); displayFor(a); shiftRight(1);

setPixel(0,3); displayFor(a); shiftRight(1);

for (int i = 0; i < 2; i++){
setPixel(0,2); displayFor(a); shiftRight(1);}

setPixel(0,1); displayFor(a); shiftRight(1);

}

void movingBars(int a){
for (int count = 1; count < 15; count++){
if (count < 9){
setRow(count, 1, 1, 1, 1, 1, 1, 1, 1);
setCol(count, 1, 1, 1, 1, 1, 1, 1, 1);}
if (count > 8){
setRow(map(count,9,14,7,2), 1, 1, 1, 1, 1, 1, 1, 1);
setCol(map(count,9,14,7,2), 1, 1, 1, 1, 1, 1, 1, 1);}

displayFor(a);
allOff();
}
}

void randomPixels(int a, int b){
for (int count = 0; count < a; count++){
setPixel(random(8),random(8));
}

displayFor(b);
allOff();
}

void swirl(int a, int b, int c){

setPixel(b,c);
// setPixel(b,c+1);
// setPixel(b+1,c);
// setPixel(b+1,c+1);

for(int count = 1; count < 6; count += 2){
for(int i = 0; i < count; i++){
shiftDown(1);
displayFor(a);
}
for(int i = 0; i < count; i++){
shiftRight(1);
displayFor(a);
}
for(int i = 0; i < count+1; i++){
shiftUp(1);
displayFor(a);
}
for(int i = 0; i < count+1; i++){
shiftLeft(1);
displayFor(a);
}
}
for(int i = 0; i < 7; i++){
shiftDown(1);
displayFor(a);
}
for(int i = 0; i < 7; i++){
shiftRight(1);
displayFor(a);
}
for(int i = 0; i < 7; i++){
shiftUp(1);
displayFor(a);
}
}

void matrixEffect(int pixels, int b){

randomArray[0] = random(8);

for (randomArray[1] = random(8); randomArray[1] == randomArray[0]; randomArray[1] = random(8));

for (randomArray[2] = random(8); randomArray[2] == randomArray[0] || randomArray[2] == randomArray[1]; randomArray[2] = random(8));

for (randomArray[3] = random(8); randomArray[3] == randomArray[0] || randomArray[3] == randomArray[1] || randomArray[3] == randomArray[2]
; randomArray[3] = random(8));

for (randomArray[4] = random(8); randomArray[4] == randomArray[0] || randomArray[4] == randomArray[1] || randomArray[4] == randomArray[2]
|| randomArray[4] == randomArray[3]; randomArray[4] = random(8));

for (randomArray[5] = random(8); randomArray[5] == randomArray[0] || randomArray[5] == randomArray[1] || randomArray[5] == randomArray[2]
|| randomArray[5] == randomArray[3] || randomArray[5] == randomArray[4]; randomArray[5] = random(8));

for (randomArray[6] = random(8); randomArray[6] == randomArray[0] || randomArray[6] == randomArray[1] || randomArray[6] == randomArray[2]
|| randomArray[6] == randomArray[3] || randomArray[6] == randomArray[4] || randomArray[6] == randomArray[5]; randomArray[6] = random(8));

for (randomArray[7] = random(8); randomArray[7] == randomArray[0] || randomArray[7] == randomArray[1] || randomArray[7] == randomArray[2]
|| randomArray[7] == randomArray[3] || randomArray[7] == randomArray[4] || randomArray[7] == randomArray[5] || randomArray[7] == randomArray[6]
; randomArray[7] = random(8));

for(int count = 0; count < 8; count++){
if (count < pixels) on8[randomArray[count]] = 1;
if (count >= pixels) on8[randomArray[count]] = 0;
}

displayFor(b);
shiftUp(1);

}

void listAZ(int a){
A(); displayFor(a); allOff();
B(); displayFor(a); allOff();
C(); displayFor(a); allOff();
D(); displayFor(a); allOff();
E(); displayFor(a); allOff();
F(); displayFor(a); allOff();
G(); displayFor(a); allOff();
H(); displayFor(a); allOff();
I(); displayFor(a); allOff();
J(); displayFor(a); allOff();
K(); displayFor(a); allOff();
L(); displayFor(a); allOff();
M(); displayFor(a); allOff();
N(); displayFor(a); allOff();
O(); displayFor(a); allOff();
P(); displayFor(a); allOff();
Q(); displayFor(a); allOff();
R(); displayFor(a); allOff();
S(); displayFor(a); allOff();
T(); displayFor(a); allOff();
U(); displayFor(a); allOff();
V(); displayFor(a); allOff();
W(); displayFor(a); allOff();
X(); displayFor(a); allOff();
Y(); displayFor(a); allOff();
Z(); displayFor(a); allOff();
}

void loop(){
//randomPixels(10,30);
//movingBars(75);
//test();
//listAZ(20);
//swirl(25,3,3);
//matrixEffect(1,30);
sinWave(20);
//pixelTest();
/*byte text[] = "HELLO_THIS_IS_EXTREMELY_SCHWAG";

for (int i = 0; i < sizeof(text); i++) {
chooseCharacter(text[i]);
displayFor(200);
}
allOff();*/

/*byte text[] = "DUBSTEP ";

for (int i = 0; i < sizeof(text); i++) {
scroll(text[i],text[i+1],60,7);
}*/

/* swirl(30,3,3);
for (int i = 0; i < 4; i++) movingBars(50);
for (int i = 0; i < 90; i++) matrixEffect(1,50);*/

}
``````

I only started on this like 4 days ago so its not perfect or complete but it works really well and its relatively simple to work with. Sorry about the broken up segments, it was too big to post

Is there a reason you're using a 16 x 8 image buffer for output to an 8 x 8 LED matrix?

Is there a reason you're using a 16 x 8 image buffer for output to an 8 x 8 LED matrix?

Actually yeah. I treat it like a second display region so when I'm scrolling text I write the next letter into that space and then I can use my shift function to move it into the real display area. Works like a charm. I realize that I could like read the next letter one column at a time or something but I kinda like it how it is

Obviously the problem with this is I'm trying to pass an array through a function which you cant do.

"Through"? You can pass arrays TO functions. Where did you get the idea that you can't?

Thats what I meant. I can't pass it directly as in

int newfunction(int a[]){ //insert function here }

but you can use pointers which is what I ended up doing and its working now

I can't pass it directly as in

int newfunction(int a[]){ //insert function here }

Sure you can. If you tell the function, at some point, how big the array is. You can either put a value in the [], if the array is always the same size, or pass another argument, if the array size can change.

but you cant do it directly. At this point I don't really remember exactly what the problem was because I figured it out so it doesn't really matter