Pages: [1]   Go Down
Author Topic: independent timer / delay - tlc5940 or anywhere!  (Read 371 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino nice
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: