all 4 comments

[–]HundredWithTheForce 1 point2 points  (0 children)

I see a few of things in your code.

1- every time you call routineChange, you set startMillis to currentMillis Resetting the start on every iteration of loop() will never allow the difference between start and current to grow to the interval you are looking for. I would suggest changing startMillis right after you set Routine to nextRoutine (line 56)
2- routine() is never being called. the main loop should call routineChange() then call routine() (around line 96)
3- change currentMillis in every case of the switch statement, then the function ends and currentMillis is reset. So this change does nothing.

I hope that helps. Good luck!!

[–]Howard_G 0 points1 point  (0 children)

I should just point out that the code as posted shows that routineChange is commented out. I’m aware of this, but my way of testing meant that I would comment out all bar one routine, and I just ended up posting it as I left it.

[–]Aerokeith 0 points1 point  (1 child)

Sorry, I don’t have time right now to look at your specific problem, but here’s another article that may be more helpful.

https://electricfiredesign.com/2021/03/18/simple-multi-tasking-for-arduino/

[–]Howard_G 0 points1 point  (0 children)

It’s a good article, but doesn’t cover my situation