Multiple non-blocking countdown timers?
Would a non-blocking timer solution work?


Yes.  Your "timer" doesn't have to be anything more than a start time from millis() and a flag.  Then your loop just compares the start time to the current millis() value, and if it's more than the interval you wanted, do the "thing".  In code:

uint32_t startTime;
bool waiting = false;
const uint32_t PUMP_DURATION = 30000UL;

void setup()
{
  // start the "timer"
  startTime = millis();
  waiting = true;
}

void loop()
{
  if (waiting &amp;&amp; (millis() - startTime &gt;= PUMP_DURATION)) {
    waiting = false;
    // do something now!
    foo();
  }


The flag keeps it from checking when the pump isn't running.

If you have multiple timed things, just make another set of variables (i.e., startTime2 and waiting2).  Give 'em better names, eh?

There are also Arduino libraries that encapsulate this common design pattern.  TimeMark is one.

Here's some sample code on the Arduino forum.