-
• #2
Isn't it supposed to be:
digitalPulse(thePin,1,0);
to wait for the current pulse to finish?
That's what the reference shows, at least.Not sure if that's the issue here - if you caught the exception and printed it out, it might give you more information.
-
• #3
It does not matter whether it is 0.0 or 1.0, it gives the same error as seen in the bottom of the list.
Uncaught [object Object]
at line 1 col 26
digitalPulse(thePin,0,0); -
• #4
Strangely, after testing other pieces of software, I tried again and now it works without error.
-
• #5
Thanks. I've managed to reproduce this so I'll try and fix it...
-
• #6
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:
digitalPulse(thePin,1,800); setTimeout(function() { digitalPulse(thePin,0,0); digitalPulse(theDummy,1,400); }, 700);
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!
-
• #7
That explains, why the fault disappeared, that was because I have set my timing to <= 300.
Thank you for looking into it.
Am I doing something wrong here.