westfw
2
In my .Ino file in main loop I have this structure
for (unsigned int i = 0; i < RoutineCount; i++){
if (Routines->Delay() == -1) {
Routines->DoWork();
} else if (Routines->_timePassed + (millis() - LastMeasure) >= Routines->Delay())
I think you should hide this code inside the class, and then have one of these choices in loop():
Sound.timeCheck(); // check each routine timeout individually
Lights.timeCheck();
// or
for (byte i=0; i<nRoutines; i++) {
Routines[i]->timeCheck();
}
I actually did something relatively similar, without C++ classes (cause I'm an old C programmer), which you can look at here: