I'm busy with programming my cube. Now I'm pretty much done with my code, however I want to simplify my code. This is where I have some problems:
int Array1[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is an animation for my led cube
int Array2[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is another animation for my led cube
void shift_out(char animation);
void loop(){
shift_out(Array1[a][b]); //'[a][b]' is used in the for loop from shift_out
delay(1000);
shift_out(Array2[a][b]);
}
void shift_out(char animation){
for(int a=0; a<5; a++){
digitalWrite(latchPin, LOW);
for(int b=0; b<6; b++){
shiftOut(dataPin, clockPin, MSBFIRST, animation); // animation need to become Array1[a][b] or Array2[a][b]
}
digitalWrite(latchPin, HIGH);
delay(1);
}
}
So if I want Array1 to show on my led cube, I need to take Array1[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array1[a][b ]. When I want to show Array2 on my led cube, I need to take Array2[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array2 [a][b ] I know its not working with char( a and b need to be declared aswell), I only wrote char in the piece of code to make it more clear what I want to do.
I can get it working if I give a and b a specific number. Like if I say Array[1][1], Array[1][1] can be written to an integer. Then I have no problems to get it to my shift_out function.
I hope I made it clear enough to understand, its kinda hard to explain .