Multiple "jobs" at different times?

Hello People.
I'm about to get started on a Arduino project, that uses the Arduino as an I/O device connected to a KNX bus coupler - and on that way integrate the I/O to the KNX BUS.

But i was planning, to have different tasks, could be:

  • Measuring S0 pulse from energy meter
  • Sending digital inputs to the Bus
  • Sending analog / I2C values to the bus

But when doing this, i need different times, like the Analog values must only be updated once per 5 min, but the S0 pulse is only active for about 40ms which i also need to catch, same as the other digital inputs i need to catch and evaluate....

I was thinking about doing something with a loop, and then read out the actual time, and add 5 min to that, and then it only ran some of it everey 5 minutes, while the rest is on full speed? What can you guys suggest?

Blink without delay - monitor millis() and perform tasks when appropriate time has passed.

Also read time before loop, then make an compare of the time and create a "offset" where next run should be?
What do you mean by "Blink without Delay"?

In the IDE under examples. Also the playground.

Mark

If you search for my post "piano tones micros" you can find code in reply #4 I think where I did this to an extreme, reading 13 inputs and creating 13 time based outputs to make an electronic organ.

Thanks - i'll take a look :slight_smile:

I wrote an extended example of the Blink Without Delay technique in the first post of this Thread which shows how to manage several things at the same time.

...R