Should getTemp return the last value, even with a callback, rather than undefined?
here is how to avoid the intial bogus value:
var sensors = s.map(function (device) { var t=ds.connect(ow, device); t.getTemp(); return t; }); sensors.forEach(function (sensor, index) { console.log('initial' + ": " + sensor.getTemp()); });
This could be done automagically in the constructor here:
this.type=parseInt(this.sCode[0]+this.sCode[1]); this.getTemp(); // trigger a conversion }
@Wilberforce 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.
Should getTemp return the last value, even with a callback, rather than undefined?
here is how to avoid the intial bogus value:
This could be done automagically in the constructor here: