Callbacks are an option, but I tend to like promises more :P But still, that makes the actual call "nested" in a sense.
I'm looking for a possible way to just do
var data = hdc.read();
and it "just works." This would be possible with async/await but from what I can see it's not yet available in Espruino (yet).
If Espruino had a delay I can do away with the setTimeout and just delay for a few ms at that point and everything should work (this is actually how the Arduino libraries do it) but delay doesn't sound like the Espruino way of doing things.
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.
Callbacks are an option, but I tend to like promises more :P But still, that makes the actual call "nested" in a sense.
I'm looking for a possible way to just do
and it "just works." This would be possible with async/await but from what I can see it's not yet available in Espruino (yet).
If Espruino had a delay I can do away with the setTimeout and just delay for a few ms at that point and everything should work (this is actually how the Arduino libraries do it) but delay doesn't sound like the Espruino way of doing things.