Hello!
So I'd promised I'd help a fellow member with some TLC5940 Rainbow code and I'm having a little bit of trouble.
For some reason nothing gets output on the LEDs, at all. The code seems fine but I don't get why it won't come on.
I'm using 15 RGB Leds with 3 TLC5940's and I don't have the channel 0 connected on any of their respective TLC5940's
You can also see that I have each TLC5940 separated by color.
I already have the values for the colors in, its just making it fade.
/*
Rainbow fader using 3 TLC5940 along with 15 common anode RGB LEDs
By Shannon Strutz
8/15/2012
funkyguy4000.wordpress.com
*/
#include "Tlc5940.h"
#include "tlc_fades.h"
TLC_CHANNEL_TYPE channel;
//Defining RGB Color pins. Notice I have each color on their own TLC5940
int BluePins[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int GreenPins[] = {18,19,20,21,22,23,24,25,26,27,28,29,30,31,32};
int RedPins[] = {34,35,36,37,38,39,40,41,42,43,44,45,46,47,48};
//Defining colors. Rainbow goes Red->Orange->Yellow->Green->Blue->Indigo->Violet->Repeat
int RRed = 255;
int BRed = 0;
int GRed = 0;
int Red[] = {RRed, BRed, GRed};
int ROrange = 255;
int BOrange = 127;
int GOrange = 0;
int Orange[] = {ROrange, BOrange, GOrange};
int RYellow = 255;
int BYellow = 255;
int GYellow = 0;
int Yellow[] = {RYellow, BYellow, GYellow};
int RGreen = 0;
int BGreen = 0;
int GGreen = 255;
int Green[] = {RGreen, BGreen, GGreen};
int RBlue = 0;
int BBlue = 255;
int GBlue = 0;
int Blue[] = {RBlue, BBlue, GBlue};
int RIndigo = 75;
int BIndigo = 130;
int GIndigo = 0;
int Indigo[] = {RIndigo, BIndigo, GIndigo};
int RViolet = 143;
int BViolet = 255;
int GViolet = 0;
int Violet[] = {RViolet, BViolet, GViolet};
int RedRainbow[] = {Red[0], Orange[0], Yellow[0], Green[0], Blue[0], Indigo[0], Violet[0]};
int BlueRainbow[] = {Red[1], Orange[1], Yellow[1], Green[1], Blue[1], Indigo[1], Violet[1]};
int GreenRainbow[] = {Red[2], Orange[2], Yellow[2], Green[2], Blue[2], Indigo[2], Violet[2]};
//int Rainbow[] = {RedRainbow[], BlueRainbow[], GreenRainbow[]};
void setup()
{
Tlc.init();
}
void loop()
{
uint16_t duration = 200;
for (int r = 0; r<17 ; r++)
{
uint32_t startMillisr = r*10;
uint32_t endMillisr = startMillisr + duration;
tlc_addFade(RedPins[r], Red[0], Orange[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Orange[0], Yellow[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Yellow[0], Green[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Green[0], Blue[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Blue[0], Indigo[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Indigo[0], Violet[0], startMillisr, endMillisr);
tlc_addFade(RedPins[r], Violet[0], Red[0], startMillisr, endMillisr);
if (r == 16)
{
r = 0;
}
}
for (int g = 0; g<16; g++)
{
uint32_t startMillisg = g*10;
uint32_t endMillisg = startMillisg + duration;
tlc_addFade(GreenPins[g], Red[1], Orange[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Orange[1], Yellow[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Yellow[1], Green[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Green[1], Blue[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Blue[1], Indigo[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Indigo[1], Violet[1], startMillisg, endMillisg);
tlc_addFade(GreenPins[g], Violet[1], Red[1], startMillisg, endMillisg);
}
for (int b = 0; b<16; b++)
{
uint32_t startMillisb = b*10;
uint32_t endMillisb = startMillisb + duration;
tlc_addFade(BluePins[b], Red[2], Orange[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Orange[2], Yellow[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Yellow[2], Green[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Green[2], Blue[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Blue[2], Indigo[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Indigo[2], Violet[2], startMillisb, endMillisb);
tlc_addFade(BluePins[b], Violet[2], Red[2], startMillisb, endMillisb);
}
tlc_updateFades();
}