OK, that makes a little more sense, but i still dont fully understand how i can update the anodes in that while loop.
// code for a 36 x 24 array (12 RGB LEDs, 24 columns)
#include <SPI.h>
// set up an array for the cathode drives
byte cathode6[] = { //chip 6, first 3rd of display
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
byte cathode7[] = { //chip 7, second 3rd of display
0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01, 0, 0, 0, 0, 0, 0, 0, 0
};
byte cathode8[] = { //chip 8, third 3rd of display
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};
byte chip5[24];
byte chip4[24];
byte chip3[24];
byte chip2[24];
byte chip1[24];
int columncount = 0;
int rowcount = 0;
int time = 500;
const int oe = 10;
void setup(){
SPI.begin();
pinMode(oe, OUTPUT);
digitalWrite(oe, LOW);
Serial.begin(9600);
randomSeed(analogRead(A0));
}
void loop(){
//we have to transfer out the cathodes first
for (int x = 0; x < 24; x++){
SPI.transfer(cathode8[x]);
SPI.transfer(cathode7[x]);
SPI.transfer(cathode6[x]);
SPI.transfer(chip5[x]);
SPI.transfer(chip4[x]);
SPI.transfer(chip3[x]);
SPI.transfer(chip2[x]);
SPI.transfer(chip1[x]);
}
unsigned long startTime = micros();
while(micros() - startTime <= 500){
// read buttons, update array, etc
int randomnum1 = random(0, 255);
int randomnum2 = random(0, 255);
int randomnum3 = random(0, 255);
int randomnum4 = random(0, 255);
int randomnum5 = random(0, 255);
SPI.transfer(chip5[randomnum5]);
SPI.transfer(chip4[randomnum4]);
SPI.transfer(chip3[randomnum3]);
SPI.transfer(chip2[randomnum2]);
SPI.transfer(chip1[randomnum1]);
} // end while
// 'while' finally expires, the display refresh runs the next x
} // end void loop
When i only assign full on i get strange colors everywhere that dont move or change, this just gives very faint random colors. what is wrong? and how can i update those anodes?