You are reading a single comment by @Bert-Holland and its replies. Click here to read the full conversation.
  • I try to make a loop with a dynamic intervaltime.
    I don't know how to fix this.
    Do someone have a suggestion for me?

    var c = 1;
    var time = 15;
    function flash(time){
      on = !on;
      digitalWrite(A0, on);
      
      c++;
      if(c >= 20){
        digitalWrite(LED1, 1);
      } 
      if(c >= 40){
        digitalWrite(LED2, 1);
      }
      if(c >= 60){
        digitalWrite(LED3, 1);
      }
      if(c >= 80){
        c = 0;
        digitalWrite([LED1, LED2, LED3],0);
        time += 25;
        return time;
        
      }
    }
    
    setInterval(flash,time);
    

    Thanks!

About