@Gordon, great idea... and the IP can be put into a module to externalize the same way as the network credentials - SSID and password - as mentioned in this (and another) post.
The creds object can be complemented with other information you need, but at some point you will just create another object of less data privacy and call it cfg and store and use it the same way as the creds object.
Giving the module a suffix (and id to the object) - such as XYZ - you can have multiples and load the code to the different devices with respective credentials and configuration.
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.
@Gordon, great idea... and the IP can be put into a module to externalize the same way as the network credentials - SSID and password - as mentioned in this (and another) post.
You place the module code
as
credsXYZ.js
into your project's sandbox .../modules folder and pull it into your code and use it this way:The creds object can be complemented with other information you need, but at some point you will just create another object of less data privacy and call it cfg and store and use it the same way as the creds object.
Giving the module a suffix (and id to the object) - such as XYZ - you can have multiples and load the code to the different devices with respective credentials and configuration.
2cts about code modularity / reuse / 'hiding'.