Hi - thanks!
I've just filed an issue for this here: https://github.com/espruino/Espruino/issues/2001
It looks like Puck.js looks at BTN's state after any reset, not just when it boots. I'll have a look at fixing that for the next release.
However, to work around it an easy fix is just to trigger your command when the button is released, not when it's pressed (eg rising -> falling):
rising -> falling
setWatch(function() { LED1.write(1); reset(); }, BTN, {edge:"falling", debounce:50, repeat:true});
@Gordon started
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.
Hi - thanks!
I've just filed an issue for this here: https://github.com/espruino/Espruino/issues/2001
It looks like Puck.js looks at BTN's state after any reset, not just when it boots. I'll have a look at fixing that for the next release.
However, to work around it an easy fix is just to trigger your command when the button is released, not when it's pressed (eg
rising -> falling
):