It's an odd one - on 'official' boards digitalPulse queues events into a hardware timer and is effectively asynchronous, plus execution speed seems about fast enough that your code should be ok.
On ESP8266 digitalPulse is synchronous so you have to use arrays, but there was some work done a few months ago to make it async on ESP32 as well - so as you say it probably just comes down to execution speed on ESP32 not being quite fast enough.
Even if you don't want to pack into an array, it's possible that changing:
digitalPulse(D16, 0, 4.4);
digitalPulse(D16, 1, 4.2);
digitalPulse(D16, 0, [4.4,4.2]);
and so on would reduce the overhead enough that it'd work.
© Espruino, powered by microcosm.
Report a problem