• Because Espruino works interrupt driven, caches incoming interrupts, and is very fast, it is looking like 'quasi simultaneously'. The typical 'Arduino loop' is kind of in the Espruino firmware: if an interrupt comes in, Espruino firmware 'calls' application part - callback - as you write in JavaScript and pass to the firmware.

    Take for example the receipt of data from any of the type of connections you mention - even for internet connection. When setting up the connection with connect or operations such as request operations on a connection, application callback/s is/are passed. On successful / failed receipt, the callback is invoked with the received data / error.

    A good example you can find in the BMP085/BMP180 DIGITAL PRESSURE SENSOR module documentation: With the request an application callback is passed, which on data receipt is called with the data. In the example, the application just does log the data to the console. After the callback completes, Espruino goes to either idle and 'waiting' for the next interrupt, or takes on the pending interrupts as queued.

    The architectural decision to make all interrupt driven enables the low power consumption not achievable easily with any other boards. Arduino even lets control the state after completing busy down to even deep sleep, and with that to almost be outlived by the battery it lives of - depending on the self-discharge of the battery and of course the power consumption when doing something.

About

Avatar for allObjects @allObjects started