Yes. I believe you're still having a problem with your if statement
if (channelOne == channelTwo || channelThree)
The "OR" clause will be true if channelThree is non-zero. Is that really what you want?
I'd expect something like this
if (channelOne == channelTwo) || (channelOne == channelThree)
Also have you tried the example code to see if it works as it should?
I hope this helps,
Brad (KF7FER).
EDIT: So do you understand that there is a single channel no matter how many TLC5940's you've got? So a channel value of 0-15 is the first TLC5940, 16-31 is the second, etc. Just unsure what your code is supposed to do.
Also you've got this
TLC_CHANNEL_TYPE channel;
And then you use channelOne, channelTwo, and ChannelThree. You probably want to define them as non-int just to be proper.
I'm not sure if it will help or not, but this is how I do fades
// Fade in effect
void fadeIn(void) {
TLC_CHANNEL_TYPE sideChannel;
uint32_t startMillis = millis() + 10;
uint32_t endMillis = startMillis + UP_DURATION;
for (int indx = 0; indx < NO_LIT_LEDS; indx++) {
channel = CHANNEL_BASE + (NO_SEGMENTS * indx);
tlc_addFade(channel, 0, MAX_VALUE, startMillis, endMillis);
if (multiLED) {
// now for the "side" channels, starting with the LEFT side
if (channel == CHANNEL_BASE)
sideChannel = CHANNEL_BASE + lastChannel;
else
sideChannel = channel - 1;
tlc_addFade(sideChannel, 0, MAX_SIDE_VALUE, startMillis, endMillis);
// finally the RIGHT side channel
if (channel == CHANNEL_BASE + lastChannel)
sideChannel = 0;
else
sideChannel = channel + 1;
tlc_addFade(sideChannel, 0, MAX_SIDE_VALUE, startMillis, endMillis);
}
}
while (tlc_isFading(channel))
tlc_updateFades();
}
Note that the function doesn't exit until the fade effect is complete.
Also 'channel' and 'lastChannel' are globals define as TLC_CHANNEL_TYPE.
Maybe this will help you see a different way to do things,
Brad.
EDIT: I should add that I've actually got 3 TLC5940's and I'm lighting LEDs in a circular pattern. But what happens in the for loop really doesn't matter, maybe just try and setup your fades first then have the while/tlc_updateFades loop.
I dont know if you are still interested in the question what is TLC_CHANNEL_TYPE:
Here it is:
It' the type definition of the channel variable, which is usually unsigned char. This means you can daisy chain 16 TLC with 16 channels = 256 channels.
If you connect more than 16 TLC's in a chain you must change the type to int otherwise you could not address the 17th TLC you would access the first one...