4 ms·
Arduino is notorious for promoting this sort of synchronous, main-loop only code. It is a horrible model for embedded devices unless they are severely resource
by kevin_thibedeau 4y ago
Arduino is notorious for promoting this sort of synchronous, main-loop only code. It is a horrible model for embedded devices unless they are severely resource constrained.
- gsliepen 4y agoIt's not uncommon to be resource constrained on embedded devices. I actually worked on something quite similar as kayson, helping create a device to synchronize a camera with a LED that was pulsed with a constant current in order to generate photon transfer curves. The pulses had to be as accurate as possible, and indeed doing the inline assembly loop with NOP instructions was the way to go: simple, deterministic, and the possibility to have pulses down to a single clock cycle. I believe PWM wasn't possible because it couldn't have pulses that short and still support the required minimum interval between pulses. But I do agree that it would be much more helpful if tutorials for Arduino would promote using timers and interrupts.
- scoutt 4y agoIf the alternative you propose is RTOS/scheduler then the synchronous main-loop approach for embedded is, by far, more common than the alternative.