When you develop/test (without the last line), you upload the code and invoke the onInit() function in the console with a command, or, you can just add as last line ('onInit()') in the code and you have it quicker going. I would though not have the last line in the version of teh code hat you save to the board, because running code may have started timers which may mess up 'your life'...
So much for the code correctness... ;-).
To use Espruino through blockly, blockly needs some more work to cover all Espruino specifics.
Now for your actual case, I have to mentally picture it first, before elaborating on possible code changes.
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.
Your final code looks then like:
When you develop/test (without the last line), you upload the code and invoke the
onInit()
function in the console with a command, or, you can just add as last line ('onInit()') in the code and you have it quicker going. I would though not have the last line in the version of teh code hat you save to the board, because running code may have started timers which may mess up 'your life'...So much for the code correctness... ;-).
To use Espruino through blockly, blockly needs some more work to cover all Espruino specifics.
Now for your actual case, I have to mentally picture it first, before elaborating on possible code changes.