Btw, if I would be more experienced in the use await, async function and Promise - the code could be a bit more in-line... The solution I sketched was the crowbar way and way before Promise existed.
At the Chrome Dev Summit 2018 in SF mid Nov I noticed the await in conjunction with JS in the browser driving a Midi interface; see The Web-Connected MIDI Trumpet Robot from @urish">Uri Shaked - Uri also on Espruino forum w/ @urish.
At one time, the project used a Pixle in an enclosed, pressurized container controlling the compressor over BLE to drive the trumpet via latex lips... see youtube https://www.youtube.com/watch?time_continue=1&v=9hOYcU34KMs
taken from We tried to build a Robot that plays the Trumpet and Happily Failed. But unfortunately, it was not reliable enough, and the solution as described in the link was used: focus a speaker to the mouth piece and use the tropet w/ correct fingering as a resonating transmission media/tube...)
I do not know about the implementation of await in Espruino. It would make many things very easy. The loop could then be inline and make the code very readable.
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.
Btw, if I would be more experienced in the use await, async function and Promise - the code could be a bit more in-line... The solution I sketched was the crowbar way and way before Promise existed.
At the Chrome Dev Summit 2018 in SF mid Nov I noticed the
await
in conjunction with JS in the browser driving a Midi interface; see The Web-Connected MIDI Trumpet Robot from @urish">Uri Shaked - Uri also on Espruino forum w/ @urish.At one time, the project used a Pixle in an enclosed, pressurized container controlling the compressor over BLE to drive the trumpet via latex lips... see youtube https://www.youtube.com/watch?time_continue=1&v=9hOYcU34KMs
taken from We tried to build a Robot that plays the Trumpet and Happily Failed. But unfortunately, it was not reliable enough, and the solution as described in the link was used: focus a speaker to the mouth piece and use the tropet w/ correct fingering as a resonating transmission media/tube...)
I do not know about the implementation of
await
in Espruino. It would make many things very easy. The loop could then be inline and make the code very readable.