setCredentials() Behavior 1.0.1

Hi all,

Question about setCredentials for Photon 1.0.1 (and others if pertinent)…

I have read other posts from 2-3 years ago, suggesting it was not great for the device to use setCredentials() to reset existing credentials. I do want to embed one default network in the code though.

If I were to call setCredentials() 5X times on the photon with the same SSID/PW, would it clear out all the others, or does the function check for an existing match first?

Currently nothing would happen when the exactly same set of creds is already present on the device.
If you want to ensure onle one set of creds you should use WiFi.clearCredentials() and then set that one set once. But use with care repeatedly clearing/re-setting isn’t good practice, to say the least.

Ah, thank you.

I am just looking for a lazy way to ensure that one specific SSID is always programmed. This is not a product, but a project for a school; so I’ll probably embed the SSID in there and set it in the setup() loop. As long as doing so doesn’t wear on the EEPROM.

@jed another way is to hold down the setup button until the LED flashes blue and then keep holding until it flashes rapidly blue. This will have cleared the wifi credentials. Plug the usb into a computer with a terminal, connect via serial and press ‘W’ you can then enter wifi credentials. They will be stored in the wifi module flash. There is no need to use eeprom.

Well, the plan for this is to run a kids’ game in a school fair. It will run on batteries, and get used once a year.

Ideally nothing on it ever gets updated again.

In reality, there are a couple parameters (delays, brightness, etc) that I suspect I will want to set in the field after it’s being used by these hundreds of 7 year olds.

So my plan is to reveal those as cloud variables, and use my phone to provide a hotspot and the console to update them. If I store them in EEPROM I can set them once, and then the parents next year will just have to replace the batteries.

I shouldn’t need to update WiFi credentials, as the only reason to ever connect to the could would be for me to do it. However, I want to make sure I can service it in the future if need be, but in the field. Which means no serial/usb connectivity if I can help it.

Embedding the hotspot wifi creds is just a way for me to ensure that they will be there when I bring it to the school for the fair. In my experience, something always goes wrong with stuff like this, and I won’t have a laptop with me.

For this use case you could also use SoftAP. This way the Photon exposes its open SSID to which your phone can connect and access a setup page which allows you to setup WiFi creds and additional config variables.