I have trouble to understand when I would call save() load() and reset(). I've declared a few global variables at the top of my espruino code:
var channel, led2State, debug;
These variables are initialized in an onInit() function, that I typically call manually once I have moved the code over to the device. The onInit() function is called once the device starts up - e.g. after a reset button click, right?
Now, I could also make the onIinit() call at the bottom of the code - once I flash the code over, it would execute the onInit() once, - just like after a reset. But a reset - if I understand correctly - will not execute the onInit() twice, as the call to onInit() is done by the system.
Are these assumptions correct?
Is it OK to declare global variables -what happens to these once I do a save()?
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.
Hi all,
I have trouble to understand when I would call save() load() and reset(). I've declared a few global variables at the top of my espruino code:
var channel, led2State, debug;
These variables are initialized in an onInit() function, that I typically call manually once I have moved the code over to the device. The onInit() function is called once the device starts up - e.g. after a reset button click, right?
Now, I could also make the onIinit() call at the bottom of the code - once I flash the code over, it would execute the onInit() once, - just like after a reset. But a reset - if I understand correctly - will not execute the onInit() twice, as the call to onInit() is done by the system.
Are these assumptions correct?
Is it OK to declare global variables -what happens to these once I do a save()?
Thx
Sven