Pages: [1]   Go Down
Author Topic: TLC 5940 fades  (Read 512 times)
0 Members and 1 Guest are viewing this topic.
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.
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;


Offline Offline
Sr. Member
Karma: 1
Posts: 255
Arduino still rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: