I'm not sure - what you're doing sounds fine. Maybe rather than setInterval you could just do a setTimeout after you've got the result? It might be simpler than having to have a boolean value as well?
What are you actually reading the values for? Is it something that is likely to change quickly?
If it's not going to change quickly, it might actually be worth checking even less often. If you're powering stuff off a battery you could power the sensors down when you don't need them, and checking every 10 minutes vs every 10 seconds would make a massive difference to power usage (if you care about that).
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 you're doing sounds fine. Maybe rather than
setInterval
you could just do asetTimeout
after you've got the result? It might be simpler than having to have a boolean value as well?What are you actually reading the values for? Is it something that is likely to change quickly?
If it's not going to change quickly, it might actually be worth checking even less often. If you're powering stuff off a battery you could power the sensors down when you don't need them, and checking every 10 minutes vs every 10 seconds would make a massive difference to power usage (if you care about that).