Hi All,
I have a pump that runs intermittently and need to perform some clean-up stuff after every hour of run-time.
[edit] Forgot t mention that the pump can be running anywhere from one-minute to several hours at a time.
[/edit]
I am not sure if I am over-thinking this but have spent a lot of time trying to make this work.
Is there a simple method to accumulate that pump run time, then do the clean-up?
const oneHour = 3600000;
uint32_t runTime = 0;
bool pumpOn = false;
void setPump(bool toWhat) {
if (toWhat) {
digitalwrite(pinPump,HIGH);
pumpOn = true;
//so here is where I would set the millis in a normal timing loop.
pumpRunTime = millis();
//but, they need to be accumulated -- not just started
} else {
digitalwrite(pinPump,LOW);
pumpOn = false;
}
}
void checkPumpTime() {
if (millis() - runTime > oneHour) {
// Do the other stuff
runTime = millis();
}
}
Thanks