Go Down

Topic: independent timer / delay - tlc5940 or anywhere! (Read 406 times) previous topic - next topic

redhotdaddy

Hi,
I am currently using Peter Mackeys code to drive a tlc5940. At the moment I have 32 LEDs that fade in and out sequentially.

http://pixelriot.com/pmatp/node/15

His code loops the following:

void loop () {
 incrementFades();
 setGreys();
 feedPorts();      
}

But I want to create an adjustable delay that I can put at any point along the run of the LED chase. For example Id like led's 0-18 to light up and fade out as normal, and then LED#19 wont start until 3 seconds later.

What Ive done is made an incrementFadesA() and incrementFadesB(), where A's loop goes from 0-17, and B's goes from 18-31.

Because the tlc5940 needs to be updated constantly, putting in a simple delay(300); wont work.

Ive been trying things like


void loop () {
 setGreys();
 feedPorts();      

     if(millis()<900){
        incrementFadesA();
     }

     if (millis()>=1500) {
        incrementFadesB();
     }
}


but only incrementFadesA(); will work.

Is there an independent timer or sequence I can run that wont affect the setGreys() or feedPorts(), so that I can run incrementFadesB() at a later time?

thanks


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!

Arduino
via Egeo 16
Torino, 10131
Italy