• Update for Espruino board since it only has 3 lights... Also added ability to stop and restart it. Change the value of i to control how fast the lights change (in milliseconds), by default run=true, setting to false will stop it. You can now resume by setting run=true again. Enjoy!

    var i = 1000, run = true;
    function flashLights() {
        LED3.write(false);
        LED1.write(true);
        setTimeout(function () {
            LED1.write(false);
            LED2.write(true);
            setTimeout(function () {
                LED2.write(false);
                LED3.write(true);
                setTimeout(function () {
    				if (run) {
    					flashLights();
                    } else {
                      var checkForRestart = setInterval(function () {
                        if (run) {
                          clearInterval(checkForRestart);
                          flashLights();
                        }
                      }, 500);
                    }
                }, i);
            }, i);
        }, i);
    }
    flashLights();
    
About

Avatar for Austin @Austin started