You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • In case you still struggle with MainCodeMenu.js code, no surprise to me: upload invokes at the end setup(). This means that before the upload can complete, things get executed... setup() is also called in E.on("init",...);.

    Even though I cannot validate the following change, give it a try: put setup() at the end of the code into a setTimeout(setup,1000);.

    What I generally suggest and do is just using function onInit() { setup(); } at the end of the code. While I'm still developing it is cumbersome to every time enter setup() in the console after code upload, I add an extra line containing setTimeout(onInit,1000); and remove it after I'm done with developing. I then upload the code with this last line removed and save it. That way I have a plain vanilla code on the chip and on power on it will do what I'm expecting: run the complete setup();. Level 0 code gets right away interpreted/executed while in upload... see the (often) referenced conversation about simple explanation how to save code that espruino run on start?.

About

Avatar for allObjects @allObjects started