Just to add, the reason there isn't a delay function is because the interpreter isn't multi-threaded, so when you start writing functions that take a long time to execute, things start to lag and potentially data that comes in via Serial/USB/etc gets lost (if buffers get full).
Generally there are pretty easy ways around it - but if there was a simple delay() command then most people wouldn't bother and their experience of using Espruino would be much worse :)
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.
Just to add, the reason there isn't a
delay
function is because the interpreter isn't multi-threaded, so when you start writing functions that take a long time to execute, things start to lag and potentially data that comes in via Serial/USB/etc gets lost (if buffers get full).Generally there are pretty easy ways around it - but if there was a simple
delay()
command then most people wouldn't bother and their experience of using Espruino would be much worse :)