Go Down

Topic: Two different "wait" times (Read 346 times) previous topic - next topic

Newbee programming question: I want one thing in my sketch to run every 5 minutes and another thing run every 30 seconds. If I use the wait function, the program just stops for that period of time without doing anything else. What would be the appropriate way to handle the two timing issue?

Thanks,
Harry

PeterH

By 'wait' I assume you mean delay().

Look at the 'blink without delay' example sketch for a demonstration of how to carry out one timed activity while enabling the sketch to carry on doing other things. You can use this approach to support as many different activities as you like.
I only provide help via the forum - please do not contact me for private consultancy.

Nick Gammon

http://www.gammon.com.au/blink
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up