Ok this works
#include <Tlc5940.h>
/* Blink Multiple LEDs without Delay
*
* Turns on and off several light emitting diode(LED) connected to a digital
* pin, without using the delay() function. This means that other code
* can run at the same time without being interrupted by the LED code.
*/
const int NUMRGBLEDS = 56; //number of rgb leds
const int pin[NUMRGBLEDS] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,67,70,73,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166}; // first tlc5940 pin of every rgb led
const int NUMCHANNELS = 280; //# of rgb led's times 5
byte state[NUMRGBLEDS]; // Leave this alone
unsigned int RedVal[NUMRGBLEDS]; // Leave this alone
unsigned int GreenVal[NUMRGBLEDS]; // Leave this alone
unsigned int BlueVal[NUMRGBLEDS]; // Leave this alone
unsigned int Value[NUMCHANNELS]; // Leave this alone
unsigned long time[NUMRGBLEDS]; // Leave this alone
void setup()
{
Serial.begin(115200);
Serial.println("Initializing...");
Tlc.init();
Serial.println("Ready");
}
void loop()
{
if (Serial.available() == (64)) {
for (unsigned int i=0; i < NUMCHANNELS; ++i){
Value[i] = (Serial.read() - '0') * 100;
Value[i] = Value[i] + (Serial.read() - '0') * 10;
Value[i] = Value[i] + (Serial.read() - '0');
}
Serial.print("You Sent: ");
for (unsigned int i=0; i < NUMCHANNELS; ++i){
Serial.print(Value[i] , DEC);
Serial.print("-");
}
Serial.println();
}
for (unsigned int i=0; i<NUMRGBLEDS; ++i){
RedVal[i] = Value[i*5] * Value[i*5 + 3] / 255;
GreenVal[i] = Value[(i*5) + 1] * Value[(i*5) + 3] / 255;
BlueVal[i] = Value[(i*5) + 2] * Value[(i*5) + 3] / 255;
}
for (unsigned int i=0; i<NUMRGBLEDS; ++i){
if (Value[((i*5)+4)] > 0){
unsigned long m = millis();
if (state[i] == 1){
if (m - time[i] > 15)
{
time[i] = m;
state[i] = 0;
Tlc.set(pin[i], 0);
Tlc.set(pin[i] + 1, 0);
Tlc.set(pin[i] + 2, 0);
}}
else{
if (m - time[i] > (Value[((i*5)+4)] * 8) - 15)
{
time[i] = m;
state[i] = 1;
Tlc.set(pin[i], map(RedVal[i], 0,255,0,4095));
Tlc.set(pin[i] + 1, map(GreenVal[i], 0,255,0,4095));
Tlc.set(pin[i] + 2, map(BlueVal[i], 0,255,0,4095));
}
}
}
else{
Tlc.set(pin[i], (map(RedVal[i], 0,255,0,4095)));
Tlc.set(pin[i] + 1, (map(GreenVal[i], 0,255,0,4095)));
Tlc.set(pin[i] + 2, (map(BlueVal[i], 0,255,0,4095)));
}
Tlc.update();
}
}