Connect to Espruino (in your screenshot, Espruino shows connected)
In settings - general, check Save on Send
Put your code into a function called onInit (from Functions)
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...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This gets you over this issue:
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