Ok, looks like the error should have been reported as Timeout on Utility Timer. There were some bugs that meant that InternalError wasn't converted to a string properly.
It's because Espruino will only block for ~0.5 seconds waiting for the timer before it gives up. You'd be better off writing the code as:
That way at least Espruino can be doing other stuff for 700 of the 800 ms.
There's also the slightly hidden 'writeAtTime' method, which allows you to queue stuff up without blocking at all:
var t = getTime();
LED1.write(0); // set as output
LED1.writeAtTime(1,t+1);
LED1.writeAtTime(0,t+2);
LED1.writeAtTime(1,t+3);
LED1.writeAtTime(0,t+4);
Thanks for pointing it out - while debugging I found out that 1v67 had a huge regression that totally broke digitalPulse, so it's good that it got found before I made a release!
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.
Ok, looks like the error should have been reported as
Timeout on Utility Timer
. There were some bugs that meant that InternalError wasn't converted to a string properly.It's because Espruino will only block for ~0.5 seconds waiting for the timer before it gives up. You'd be better off writing the code as:
That way at least Espruino can be doing other stuff for 700 of the 800 ms.
There's also the slightly hidden 'writeAtTime' method, which allows you to queue stuff up without blocking at all:
Thanks for pointing it out - while debugging I found out that 1v67 had a huge regression that totally broke digitalPulse, so it's good that it got found before I made a release!