Avatar for Bert-Holland

Bert-Holland

Member since Jun 2014 • Last active Nov 2014
  • 4 conversations
  • 10 comments

Most recent activity

  • in News
    Avatar for Bert-Holland

    Congrats Gordon!

    I like the new pico already.

  • in JavaScript
    Avatar for Bert-Holland

    Thanks for your solution Gordon!

    Now that you explain me the bug that the setTimeOut called over and over again, i see the problem.
    Sometime the logic is hard to see, even if it's not the most difficult logic.(i am still a beginner :) )

    But anyway, thanks a lot!

  • in JavaScript
    Avatar for Bert-Holland

    Hi people.

    I have some troubles with the settimeout function.
    I have made a switch that an action can happen only one in the time of an interval.
    This cod is not specially meant for the espruino but i have tried this in the browser implemented in a website.
    The code works pretty well but if i click repeatedly fast, then the code ignores the if condition.
    Do i have made a mistake in this codeblock?

    var delay = true;
    function blogPostTimer(){
        if(delay == true){
            delay = false;
            postMessage();
        }else{
            setTimeout(function(){
            delay = true;
            }, 1000 * 5);
        }
    }
    
  • in General
    Avatar for Bert-Holland

    Great job Gordon! Thanks a lot.

  • in JavaScript
    Avatar for Bert-Holland

    Ok, it's clear now.

    Thank you.

  • in JavaScript
    Avatar for Bert-Holland

    Hi,

    I don't know ho i can get access to te mpu.getDegreesPerSecond(); array

    for example i want to make interaction if the y has a specific value with a if els condition.

    please help me?

    Thanks a lot...

    • 2 comments
    • 2,506 views
  • in JavaScript
    Avatar for Bert-Holland

    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!

Actions