Forgot to add that 'mistakes' I noticed are setting up (especially) setInterval(). For example, the uploading onto the board already sets one (which 'never ever should be done), then the code is saved, and for some logic reason on power up the setInterval() is called again when power is cycled. Therefore, the abcIId variable to hold the Id of the interval can be used too to prevent that. I the function is (the same and) with the same parameters, the setup() can be skipped. Otherwise, it has to be cleared and set again.
NB: If just the time of the interval changes, you do not need to clear and setup the function again: you can just change the interval:
changeInterval(abcIId,newTimeInMS); // change rime of running abc interval
© Espruino, powered by microcosm.
Report a problem