Struggling with millis() for two tasks

Here's the wokwi


It is exactly you code except I
  • changed the LED pins for wiring convenience
  • made D6 INPUT_PULLUP, understand you can use INPUT from external source
  • commented in the 4 second video segment length
  • made the brief flash of the blue (!) LED 100 ms

So no significant code changes.

I have developed a high degree of confidence in the wokwi simulator. It does let you power servos from the Arduino and use LEDs w/o series resistors, so the analog side is not full fidelity.

But the program flow, logic and timing are rock solid. The sim uses the same tool chain to create code as theIDE, then executes that code on a simulated AVR at the machine code level.

Sorry I missed your comment on the healthy long trigger pulse. TBH I am in the habit of mostly ignoring comments (!).

Comments can be redundant, misleading, wrong or any combination of those, code is what actually makes the thing do whatever it does.

No comment on your comments! I did benefit from them, just missed the answer to my question.

You can save a copy of the wokwi and go from there if the simulator is helpful.

a7