• JavaScript execution on Espruino is only single-threaded, so it's only ever going to execute one bit of JS at a time. Everything has the same precedence.

    When you print something, that goes into an output buffer, and assuming that what you print fits into that buffer the print statement will execute immediately. If not, it'll wait until enough has been sent to fit the remainder of the text in it, and it'll continue. The size of that output buffer varies depending on device, but at ~200 bytes of output it's possible you'll be filling it.

    If you're printing over USB sending 200 bytes should be done almost instantly, but if it's 9600 baud serial then it'd be taking about 200ms, which might be your issue? That would delay your interval firing (although subsequent executions of the interval would be on time unless they got delayed too).

    If you thought the sending was delaying your code from executing then you could always split the string in two and use setTimeout to send the second part after the first had completed.

    As @DrAzzy says it'd help to be able to see your code though.

About

Avatar for Gordon @Gordon started