You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • This gets you over this issue:

    1. Connect to Espruino (in your screenshot, Espruino shows connected)
    2. In settings - general, check Save on Send
    3. Put your code into a function called onInit (from Functions)
    4. Upload...

    See 1st attachment. Changing the code according to second attachment, it will print for each blink the number of the blink until it 'dies'.

    Unfortunately only for a few seconds... but at least for a few seconds you see the code working as expected.

    Issue is because the uploaded code gets active and prevents the upload to complete properly - put the prompt out. (due to the Arduino-style implemented wait: hogging the 'process' and killing cycles until the desired time has passed... which is so un-Espruino... backwards... worse than like trying to fly a plane under water... or trying to take off a sub to fly in the air...). Conclusion AND advice: DO NOT USE THE WAIT BLOCK for time longer than a few ms!

    Unfortunately this 'constant' going in javascript execution mode is never relenting to other activities, which then wait and wait an wait until the underlaying system interrupts the executing javascript.

    As you may now, in settings - General you can check that when you upload to Espruino, the uploaded JavaScript code is written to the textual coding editor. It help with the analysis of potential issues...

    Will think of providing a different solution to this wait... The wait should be a timeout for a timer with the next logical code block being started when the time times out. While the timer is ticking, Espruino can tend to other needs without interrupting the execution...


    2 Attachments

    • LoopRepeat10Times.png
    • Loop1To10.png
About

Avatar for allObjects @allObjects started