I don't think the issue is that the queue is overflowing (you'd see with E.getErrorFlags() if it was). It's just that the signal is may be changing very quickly, so by the time there is an IRQ and Espruino reads the pin state, the pin state has changed (although that should mean that the last setWatch that happens is correct).
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.
What happens if you change:
into
Not sure, but it would be interesting to see.
I don't think the issue is that the queue is overflowing (you'd see with
E.getErrorFlags()
if it was). It's just that the signal is may be changing very quickly, so by the time there is an IRQ and Espruino reads the pin state, the pin state has changed (although that should mean that the last setWatch that happens is correct).