• As @Wilberforce says...

    Just to clarify though LOW_MEMORY,MEMORY means:

    • LOW_MEMORY - Espruino ran low on memory while executing code, and had to delete command history and some other stuff so it could try and run your code properly
    • MEMORY - Espruino totally ran out of memory and couldn't execute and more, so it had to stop running your code.

    The code you actually want (using timeouts as intended) is probably:

    function go() {
      digitalWrite(A4, 0);
      setTimeout(function() {
        digitalWrite(B4, 1);
        digitalWrite(B3, 0);
        setTimeout(function() {
          digitalWrite(A4, 1);
          digitalWrite(B4, 0);
          setTimeout(function() {
            digitalWrite(B3, 1);
            go();
          }, 20);
        }, 20);
      }, 20);
    }
    
    go();
    

    Note that when you do it that way, you're actually able to do execute other code in the background as well, because you're not completely stopping execution.

About

Avatar for Gordon @Gordon started