You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Blocking is really bad idea in Espruino, so it's intentionally made really difficult! Espruino isn't pre-emptive so a long loop like that stop all other timers/watches from executing.

    Is there any reason you can't do the following:

    setTimeout(function() {
      analogWrite(C6, 2.0 / 50.0, {freq:20});
      setTimeout(function() {
        analogWrite(C6, 1.0 / 50.0, {freq:20});
      },4000);
    },4000);
    

    That will execute the first timeout, and will then start the second one once the first has completed...

About

Avatar for Gordon @Gordon started