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)