Let's Make Robots!

Code for Jorgen

long LengthOfYourPause;

long remTime;

 

void setup()

{

    LengthOfYourPause=5000;  //we will check every 5 seconds    

    remTime=millis();  //remember the current time

}

 

void loop()

{

    //do whatever stuff you normally do in a loop

   if(millis()>=remTime+LengthOfYourPause)
   {
        //do your led check or whatever you wanted to check here
       remTime=millis();  //reset your clock for the next time through

   }

}

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I usually did millis() - remTime() >= Length of pause. Same thinf :)

but now I use a single timer to handle LED stuff. Thanks CTC.

Then I looked at the arduino reference, and saw that the millis() timer wouldn't rollover for 50+ days from a system start. :)