You are reading a single comment by @alexrlopez86 and its replies. Click here to read the full conversation.
  • possible bug in this code
    bad code

    function parpadeo(time)
    {
    clearInterval(inter1);
    var  l = false;
    var inter1 = setInterval(function() {
     l = !l;
      C1.write(l);
    }, time);
    }
    
    parpadeo(200);
    function led1(time1)
    {
    clearInterval(led2);
    var  l1 = false;
    var led2 = setInterval(function() {
     l1 = !l1;
      A1.write(l1);
    }, time1);
    }
    led1(300);
    

    desired effect

    function parpadeo(time)
    {
    //clearInterval(inter1);
    var  l = false;
    var inter1 = setInterval(function() {
     l = !l;
      C1.write(l);
    }, time);
    }
    
    function led1(time1)
    {
    //clearInterval(led2);
    var  l1 = false;
    var led2 = setInterval(function() {
     l1 = !l1;
      A1.write(l1);
    }, time1);
    }
    parpadeo(200);
    led1(300);
    

    all this with tested stm32 f3 dicovery and espruino 1v61
    you will obtain a different result.

    I hope to be of help
    Thank you greetings

About