• 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:

    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.

About

Avatar for Gordon @Gordon started