Hi - I'm afraid it doesn't support it yet... It's on my list though :)
So the issue you have is that 'this' generally gets reset when you call setTimeout - however you can still access any other local variables. The easiest way around it (the one that I tend to use in examples/modules) is:
var sensor = this;
setTimeout(function (e) { sensor.getSensorReading(); }, w);
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.
Hi - I'm afraid it doesn't support it yet... It's on my list though :)
So the issue you have is that 'this' generally gets reset when you call
setTimeout
- however you can still access any other local variables. The easiest way around it (the one that I tend to use in examples/modules) is: