• ...one more thing:

    make the last two lines of the your code like this (put the original last two lines into onInit() {...}; function in order to not save messed status.

    onInit() {
      setWatch(changePattern, BTN, { repeat: true, edge:'falling' });
      setInterval(doLights,50);
    }
    

    With that change though, the code will not start on upload. This is annoying while you devleop... If you add this line as a very last line while you develop and when ready to save it, just comment this line before the upload.

    setTimeout(onInit,500); // while dev'g - comment before upload for save()
    

    I hope this helps.

    PS: How do you get rid of saved code - prevent it from automatically starting?

    When connected, inter in the console reset(1) . This will not only stop the code but also remove it from FLASH, so that a next time you power cycle, it is not there anymore to be run.

    If you want stop a piece of code, you just say reset() without argument.

About

Avatar for allObjects @allObjects started