Library for TLC5940 16-channel PWM chip

Yet another question, acleone :smiley:

Is there a way to get the immediate grayscale value of a particular channel?

In your last response, you had mentioned running additional newFade() functions inside the updateFades() while loop. I'd like to experiment with "interactions" between LEDs during the fading process and being able to grab the current value of an LED would be perfect.

Minor Example:

while(updateFades())
{
    if(getGreyscaleValue(3) > 2048)
    {
        newFade(4, 1000, 1024, 4095);
    }
}

I'll admit, I haven't delved too deeply into the code, so there may be something available I could use, without the need of anything additional. (/me goes off to skim the code as best he can)

EDIT:
Line 243 of TLC5940LED.cpp:

Tlc.set(fp->channel, fp->endValue - ((((int32_t)(fp->stopMillis - currentMillis)) * fp->dValue) / fp->duration));

That looks like it has what I'd need. Unfortunately, I don't know enough c++ to figure out whether or not I could pull that information from within the sketch itself, or if I would need to write a function for it.

I'm not 100% sure how to use structs, but it does appear that you're incrementing it, as if it's an array of data. If that's the case, it should be pretty easy to build a simple array of integers containing the current values of all active LEDs. Though, for larger numbers of LEDs, this would get fairly memory-intensive.

EDIT 2:
Would something like this work:

int TLC5940LED::getGreyscaleValue(uint8_t channel)
{
      struct fade *fp = channel;
      return (fp->endValue - ((((int32_t)(fp->stopMillis - currentMillis)) * fp->dValue) / fp->duration));
}

Again, I'm operating at Ignorance Level 10 (of 10). And I know I'm missing error-checking.