Pages: [1]   Go Down
Author Topic: TLC 5940 fades  (Read 439 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 55
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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){
      tlc_removeFades(channel[i]);
    }
    tlc_updateFades();
    
    braceletValue = map(millis(), waitTOrestart, removeBraceletTime, 255, 0);
    analogWrite(ledBracelet, braceletValue);
    //Serial.println("removing");
  }

  if (millis()>removeBraceletTime && millis()<=timeTOrestart){
    Tlc.clear();
    Tlc.update();
    braceletValue = 0;
    analogWrite(ledBracelet, braceletValue);
    Serial.println("clearing");
  }

  if(millis()>timeTOrestart){
    mode = 0;
    restart = false;
  }
}
 


Logged

Atlanta
Offline Offline
Sr. Member
****
Karma: 0
Posts: 254
Arduino still rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: