From what I can see, your code looks fine. Could you try using one of those latest builds of the firmware linked above? I found some issues recently with findDevices that could potentially be causing this.
When the device crashes, can you connect to it at all?
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.
From what I can see, your code looks fine. Could you try using one of those latest builds of the firmware linked above? I found some issues recently with
findDevices
that could potentially be causing this.When the device crashes, can you connect to it at all?