Run multiple if else simultaneously with millis

I prefer not to use the cast. The cast is confusing and gives the impression that something needs to be fixed. If something needs to be fixed, then the millis-timer does not work.

if ((unsigned long)(currentMillis - previousMillisDuration) >= duration)   // with cast for no reason
if (currentMillis - previousMillisDuration >= duration)    // okay, this is what I use
if ((currentMillis - previousMillisDuration) >= duration)   // okay

Can you take some time to go through the next lines ? It is like going back to school :wink:

Could you read my post in an other topic: Continuous serial communication between arduino and pc - #4 by Koepel and click on that video what Andreas Spiess thinks about it.
Andreas Spiess is referring to non-blocking code with millis() and he mentioned someone who uses also a Finite State Machine with that. He calls it: wearing a shirt inside out.

Your sketch is controlled by the variable 'timermode'. So the sketch can be in a few different states depending on that variable. You could call that variable 'state'.

Could you have a look at a Finite State Machine ? If you see what is going on, then it is simple: The Finite State Machine | Majenko Technologies

You could try my example millis_and_finite_state_machine.ino

If you understand the Finite State Machine with millis(), then you are an advanced Arduino programmer, even if you have to wear your shirt inside out.