Tlc5940 random fading

Hey everyone

I hope someone can help me, i am trying to make some LED's fading with TLC5940, everything goes fine, until i decided to make them fade in a random way, one led at a time. i tried different ways, looking on the internt, and i just can't figure it out.

Please any idea how to do it ? any help will be appreciated

please anyone ?

this is the code i am using, what am i doing wrong ?

#include "Tlc5940.h"
#include "tlc_fades.h"

uint32_t test = random(channel);

void setup()

void loop()
  if (tlc_fadeBufferSize < TLC_FADE_BUFFER_LENGTH - 2) {
    if (!tlc_isFading(test)) {
      uint16_t duration = analogRead(0) * 4;
      int maxValue = analogRead(0) * 2;
      uint32_t startMillis = millis() + 2000;
      uint32_t endMillis = startMillis + duration;
      tlc_addFade(test, 0, maxValue, startMillis, endMillis);
      tlc_addFade(test, maxValue, 0, endMillis, endMillis + duration);
    if (test++ > NUM_TLCS * 16 ) {
      test = 0;

A good place to start would be to add some debugging prints - I'd want to check what duration and maxValue are.

Thanks for your answer .. i got it to work, i had to change the code.

But i am interessted i what did you mean, by debugging prints, and how can i do it the get that ? ( just for learning :) )

Add some Serial.print(variable); statements at strategic points in the program so you can see what veriable values you have and compair that with what you think you should have.

Could you post the working code, I am interested in the same thing