Let me format that for you:
#include <SPI.h>
// set up an array for the cathode drives
byte left_cathode[ ] = {
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // walking 1 for lower 8 NPNs
byte mid_cathode[ ] = {
0,0,0,0,0,0,0,0, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0,0,0,0,0,0,0,0}; //walking for mid 8 NPNs
byte right_cathode[ ] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; // walking 1 for upper 8 NPNs
//set up array for anodes
byte chip5 [24]; //holds green 9-12
byte chip4 [24]; //holds green 1-8
byte chip3 [24]; //holds blue 5-12
byte chip2 [24]; //holds red 9-12 and blue 1-4
byte chip1 [24]; //holds red 1-8
int x = 0;
int previousMillis = 0;
void setup(){
SPI.begin();
}
void loop(){
for (x =0; x<24; x=x+1){
SPI.transfer(chip5 [x] ); // send the data from chip5 array position x into the chip5 shift register
SPI.transfer(chip4 [x] ); // send the data from chip4 array position x into the chip4 shift register
SPI.transfer(chip3 [x] ); // send the data from chip3 array position x into the chip3 shift register
SPI.transfer(chip2 [x] ); // send the data from chip2 array position x into the chip2 shift register
SPI.transfer(chip1 [x] ); // send the data from chip1 array position x into the chip1 shift register
// now the anodes are set with their highs & lows, turn on the cathode driver
SPI.transfer(left_cathode [x] ); // the data in these, 1,2,4,8,10,20,40,80, is set so that only 1 at a time is driven
SPI.transfer(mid_cathode [x] );
SPI.transfer(right_cathode [x] );
delayMicroseconds(500); // let the column shine a bit
} // now you've gone thru all 24 columns
// now tweak the data on chip1[ ], chip2[ ], chip3[ ], chip4[ ] and chip5[ ] to make the display change
// its late, I can't think of a pattern, do something simple for now:
if (millis() >= previousMillis){ // time to update the displays!
previousMillis = (previousMillis + 500); // change every 1/2 second
int color = color + 1; // define color as an int
if (color == 256){
color = 0;
} // reset back to 0
for (x=0; x<24; x=x+1){
chip5[x] = color; // cycle thru from 0 to 255
chip4[x] = color;
chip3[x] = color;
chip2[x] = color;
chip1[x] = color;
}
}
}// end loop
Now, how many chips do you have? 192?
for (x =0; x<24; x=x+1){
SPI.transfer(chip5 [x] ); // send the data from chip5 array position x into the chip5 shift register
SPI.transfer(chip4 [x] ); // send the data from chip4 array position x into the chip4 shift register
SPI.transfer(chip3 [x] ); // send the data from chip3 array position x into the chip3 shift register
SPI.transfer(chip2 [x] ); // send the data from chip2 array position x into the chip2 shift register
SPI.transfer(chip1 [x] ); // send the data from chip1 array position x into the chip1 shift register
// now the anodes are set with their highs & lows, turn on the cathode driver
SPI.transfer(left_cathode [x] ); // the data in these, 1,2,4,8,10,20,40,80, is set so that only 1 at a time is driven
SPI.transfer(mid_cathode [x] );
SPI.transfer(right_cathode [x] );
delayMicroseconds(500); // let the column shine a bit
} // now you've gone thru all 24 columns
Each SPI.transfer shifts out (best not leave out the F eh?) 8 bits, so you are sending out 24 * 8 * 8 bits. That's 1536 bits. Do you have 1536 LEDs?
I don't see you latching the data anywhere.