Not being able to reset the millis

I am trying to make a MP3 Player , play songs in correlation to a PulseIn signal - Throttle. I am simulating a diesel engine sound at 4 RPM levels.

I am using IF - Else functions to corelate the throttle to various "Segments" that play engine sounds.

The serial command "mp3_play (3); (for example) should be sent only once when the throttle reaches the level. So I am starting a millis counter each time when I move in different throttle ranges, then I am playing the mp3_play (3); while the milis are starting. Delay wont work, it will ruin my Pulse In reading.

I was expecting to have the Segment2Millis and Segment3Millis values restart at zero as I move in the IF - Else conditions. But this does not happen...

Please help,

DFRobotSimpleSerial01.ino (1.32 KB)

See BlinkWithoutDelay example. You need to keep track of the zero point yourself,

You can use a clock without resetting it to zero. Same thing here.
Do what KeithRB wrote.

The demo Several Things at a Time is an extended example of BWoD.

There is no need to reset millis()

...R

After all, you don't reset your clock when using it to time things, you simply take note of the start time and go from there.