Go Down

Topic: TLC 5940 fades (Read 778 times) previous topic - next topic


Hello there!
I posted this topic on the software page, but I think it was the wrong place, so I am now posting it here. I really please ask some help. This is my final project and I am stuck on this.

I am trying to finish a programme that involves 32 LEDs and 2 TLC 5940s (among other stuff). What I want basically is that at some point in time it removes all the ongoing fades and gets back to a quite all switched off situation, so that it restarts. I tried for a while but I can't get where is the problem. I am using a switch based programme and this is the last part (there are three of them: case 0; case 1; case 2).
The problem is: when the programme get back to case 0, it reproduces one last fade and then it stops. The weird thing is that in case 2 it actually removes all the fades. I also tried to debug code in case 1, but there is a lot of stuff going on there. If someone can suggest me how to solve this out (just a way to clear all processes happening on the 2 TLCs) it would be extremely appreciated. Thanks.
Code: [Select]
boolean restart = false;
unsigned long waitTOrestart;
int removeDelay = 9000;
int clearDelay = 2000;
unsigned long timeTOrestart;
unsigned long removeBraceletTime;
void endMode(){

 if (restart == false){
   restart = true;
   waitTOrestart = millis();

 removeBraceletTime = waitTOrestart + removeDelay;
 timeTOrestart = removeBraceletTime + clearDelay;

 if (millis()<=removeBraceletTime){

   for(int i = 0; i++; i<32){
   braceletValue = map(millis(), waitTOrestart, removeBraceletTime, 255, 0);
   analogWrite(ledBracelet, braceletValue);

 if (millis()>removeBraceletTime && millis()<=timeTOrestart){
   braceletValue = 0;
   analogWrite(ledBracelet, braceletValue);

   mode = 0;
   restart = false;


cant tell what your doing, or trying to do, sorry.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131