Have you tried using an array of pulse values (see description in link above) and just a single digitalPulse() to rule out whether setInterval() is adding unnecessary (likely) intermittent delay?
Considering:
'It uses a hardware timer to produce accurate pulses'
For a 2msec pulse 4%-8% error is rather odd. . . .
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Tue 2018.11.06
Although I'll agree the accuracy isn't specified,
the implication is millisecond(s) wide pulses.
Have you tried using an array of pulse values (see description in link above) and just a single
digitalPulse()
to rule out whethersetInterval()
is adding unnecessary (likely) intermittent delay?Considering:
For a 2msec pulse 4%-8% error is rather odd. . . .