-
• #28
found another issue,
if I want to just read analog values there clearInterval is ok, but if I want to measure something continuously, like time, stopwatch etc. then every time I swap between my screens I clear interval and will stop time or stopwatch which I don't want,
any solution?
or maybe there is some already written stopwatch code here? -
• #29
When you do setInterval or setTimeout they return a value. Pass that value to clearInterval and it will only clear that one.
-
• #31
DrAzzy means when you set your interval you assign it to a global variable. For example
var state, interval; function toggleLed(){ digitalWrite(LED1,state=!state); } setWatch(function() {interval=setInterval(toggleLed,500);},BTN, {repeat: true, edge: 'rising', debounce:5});
You would call clearInterval(interval) to stop only this interval.
yes, I found it myself Gordon ;) just wanted to post I found solution ;)
my code looks now that, and is working now ;)