You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • You may have some trouble using watches on the potentiometer - setWatch is generally only for digital inputs.

    But generally:

    • setWatch queues an event basically immediately with a timestamp, which is very deterministic
    • Espruino executes that event the next time around the idle loop, which depends on what JS you're currently executing

    So as long as you keep the tasks that you're running reasonably short then your code is going to be executed within just a few milliseconds.

    The only gotcha is if for example you're blasting the UART with data faster than it can transmit then that could fill the output buffer and stop a function executing quickly, which could slow things down.

    However if you're talking about buttons and user input, setWatch is basically immediate - pretty much whatever you do it'll be executing the JS before you know it :)

About

Avatar for Gordon @Gordon started