Using millis() and micros() instead of delay
hello!
i know how execute task @ given intervals, without using delay, other things can executed @ same time. 1 method found blinkwithoutdelay example, example blinks led @ regular intervals. want execute task @ intervals can change, perhaps (e.g. pulsing ir led using , array of time intervals), or 5 seconds, wait 7 seconds, 1 second, etc. stop function, without affecting other tasks. also, millis() accurate enough execute task every 15 minutes? nointerrupts() disable or affect micros()? or example program appreciated!
i know how execute task @ given intervals, without using delay, other things can executed @ same time. 1 method found blinkwithoutdelay example, example blinks led @ regular intervals. want execute task @ intervals can change, perhaps (e.g. pulsing ir led using , array of time intervals), or 5 seconds, wait 7 seconds, 1 second, etc. stop function, without affecting other tasks. also, millis() accurate enough execute task every 15 minutes? nointerrupts() disable or affect micros()? or example program appreciated!
take another @ blink without delay example. can change interval every time throught loop,* , can have multiple intervals & multiple previous-times (with different variable names) multiple-different timers running @ same time.
i'd should avoid using delay, unless want delay or pause. for timing applications, want keep program going, while keeping track of time in background.

i've haven't used interrupts on arduino, else can jump-in , that.
* p.s.
actually, wouldn't want change time every-time through loop... want change when "time's up". example, change interval random time between 100 , 1000ms, every time led goes on or off.
i'd should avoid using delay, unless want delay or pause. for timing applications, want keep program going, while keeping track of time in background.
quote
also, millis() accurate enough execute task every 15 minutes?sure! but, it's program checking time in loop... if doing else complicated, or else can't interrupted, , get-back checking time every 10 minutes... it ain't gonna accruate!

i've haven't used interrupts on arduino, else can jump-in , that.
* p.s.
actually, wouldn't want change time every-time through loop... want change when "time's up". example, change interval random time between 100 , 1000ms, every time led goes on or off.
Arduino Forum > Using Arduino > Programming Questions > Using millis() and micros() instead of delay
arduino
Comments
Post a Comment