Bert-Holland
Member since Jun 2014 • Last active Nov 2014Most recent activity
-
-
- 3 comments
- 2,941 views
-
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); } }
-
-
- 3 comments
- 2,778 views
-
-
-
- 2 comments
- 2,600 views
-
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!
Congrats Gordon!
I like the new pico already.