Library for TLC5940 16-channel PWM chip

joe: you should wait for the PWM cycle to end before you switch transistors, eg

#define RED  0
#define GREEN 1
#define BLUE 2
uint8_t color;

void loop()
{
  color++;
  if (color == 3) {
    color = 0;
  }

  // set everything
  if (color == RED) {
    Tlc.set(0, 1000);
  } else if (color == GREEN) {
    Tlc.set(1, 1000);
  } else {
    Tlc.set(2, 1000);
  }
  Tlc.update();
  while (tlc_needXLAT)
    ;
  turn_off_transistors();
  turn_on_transistor(color);
}

I haven't measured Tlc.update() in SPI mode but way back in August I measured bit-banging to be about ~260us for 1 tlc.