I'm not sure what to suggest. This is just like setTimeout.
setTimeout
Maybe you want to read 4 values every second and write them to the console, you could do:
function everySecond() { ads.getADC(0, function(val0) { ads.getADC(1, function(val1) { ads.getADC(2, function(val2) { ads.getADC(3, function(val3) { console.log(val0,val1,val2,val3); }); }); }); }); } setInterval(everySecond, 1000);
Basically you call the function and it returns almost immediately. However it calls the function you supply at some point later on.
@Gordon started
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'm not sure what to suggest. This is just like
setTimeout
.Maybe you want to read 4 values every second and write them to the console, you could do:
Basically you call the function and it returns almost immediately. However it calls the function you supply at some point later on.