Reading your question more carefully, your problem is the value of this in the setInterval, probably the global context which is not what you want.
This can be resolved by sending the right context object for this as an added last argument in setInterval or seTimeout as below.
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,
Reading your question more carefully, your problem is the value of this in the setInterval, probably the global context which is not what you want.
This can be resolved by sending the right context object for this as an added last argument in setInterval or seTimeout as below.
So, your object, instance of class, will be called self in the setInterval/SetTimeout at execution time...
You should look at the reference of setInterval and this non Espruino thread or this other one