Could you try rebooting Puck.js with the button held down for ~10 seconds (until the red LED has stopped blinking). That should clear out any saved code.
I'm pretty sure the issue is that you had saved software from an older firmware version still in flash memory - and perhaps you weren't uploading from the right-hand side of the IDE (or reset on send was turned off in options).
I've just tried a latest build of Espruino and your code seemed to work fine.
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.
Could you try rebooting Puck.js with the button held down for ~10 seconds (until the red LED has stopped blinking). That should clear out any saved code.
I'm pretty sure the issue is that you had saved software from an older firmware version still in flash memory - and perhaps you weren't uploading from the right-hand side of the IDE (or
reset on send
was turned off in options).I've just tried a latest build of Espruino and your code seemed to work fine.