I imagine @DrAzzy/@Sacha are right here - analogRead on Espruino returns a value between 0 and 1. All you need to do to scale it up is to multiply it by 1024.
The JS code looks good - the interpreter produces a little delay in the execution so the fact that you're not delaying after the strobe probably isn't a big deal.
That doesn't explain the crash though. I'm trying it here and it's been fine for a few minutes so far... Are you using an up to date firmware? It could be there was a bug in an older version.
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.
I imagine @DrAzzy/@Sacha are right here - analogRead on Espruino returns a value between 0 and 1. All you need to do to scale it up is to multiply it by 1024.
The JS code looks good - the interpreter produces a little delay in the execution so the fact that you're not delaying after the strobe probably isn't a big deal.
That doesn't explain the crash though. I'm trying it here and it's been fine for a few minutes so far... Are you using an up to date firmware? It could be there was a bug in an older version.