• @allObjects is likely spot on - it'd be interesting to see if just removing the LED fixes it.

    But just to add to this, if you have an input that really does fluctuate a massive amount, debounce and repeat:false probably won't help you much since by the time they take effect the event queue could be full of events already.

    It's not at nice, but you could just 'poll' the input:

    var n=0;
    function poll() {
      var newn = E.clip(n+digitalRead(...)-0.5,-20,20);
      if (newn==-20 && n!=-20) ...;
      if (newn==20 && n!=20)  ...;
      n = newn;
    }
    setInterval(poll,5);
    

    Although the best solution is to try and 'clean up' the input. In your case you could add hysteresis by putting a high value resistor from the output of the comparator back into one of the two inputs (doing it to one will make it oscillate even more, the other should really sort it out).

About

Avatar for Gordon @Gordon started