You are reading a single comment by @MrTimcakes and its replies.
Click here to read the full conversation.
-
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.
@DrAzzy ,what is the proper code form to stop interval that way you said?
I tried
and it works when I typed it into console,
but when I placed that form into my code into if statement
WebIDE shows errors,
I used then clearInterval(1); instead but it isn't work