I am looking to have simultaneous execution of tasks and I am wondering if anyone has considered implementing web workers?
Specifically, I need to monitor a pin and activate a motor while sending data to a sound board over serial. However, I want the motor to stop when the pin is no longer triggered but have the sound continue.
Additionally, I would like to be able to asynchronously send data over wifi without interrupting the previous two tasks. I can see how the first one might be combined into one task with careful control of looping, but the second task will probably not be possible in the same cycle.
If I had something like a web worker, I could control the three tasks independently and trigger them when the appropriate event is detected.
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 am looking to have simultaneous execution of tasks and I am wondering if anyone has considered implementing web workers?
Specifically, I need to monitor a pin and activate a motor while sending data to a sound board over serial. However, I want the motor to stop when the pin is no longer triggered but have the sound continue.
Additionally, I would like to be able to asynchronously send data over wifi without interrupting the previous two tasks. I can see how the first one might be combined into one task with careful control of looping, but the second task will probably not be possible in the same cycle.
If I had something like a web worker, I could control the three tasks independently and trigger them when the appropriate event is detected.