• I think the issue is your use of clearInterval(); in setLed - this will clear ALL intervals, including the one calling readBatt. So in reality readBatt will only get called once.

    You probably want:

    var flashInterval;
    function setLed() {
      if (flashInterval) clearInterval(flashInterval);
      if(v < 3) {
        flashInterval = setInterval("digitalPulse(D1, 0, [200,50,100,50]);", 10000);
      } else {
        flashInterval = setInterval("digitalPulse(D1, 0, [200,50]);", 10000);
      }
    }
    
About

Avatar for Gordon @Gordon started