Did you have some code in there that had been save()d already? That could be causing you problems I guess ...
Maybe there is some other pin (a reset pin?) that needs its state changing first...
Also aren't you supposed to wait for it to initialise at some point? You don't appear to be doing that...
The code is looking good though. It'd make a module really easily.
@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.
Did you have some code in there that had been save()d already? That could be causing you problems I guess ...
Maybe there is some other pin (a reset pin?) that needs its state changing first...
Also aren't you supposed to wait for it to initialise at some point? You don't appear to be doing that...
The code is looking good though. It'd make a module really easily.