Hunt WiFi addresses

I program my IOT33 from home, and test it in my caravan.
At the moment I have to re-program the secret WiFI address and password.

Is there a way for me to put in two (or more) WiFi addresses and passwords so that it automatically picks up either home or caravan without having to reprogram?

you can put all in the sketch and try all until it connects

Put all what in the sketch?
I do not know how to put in multiple WiFi addresses.

addresses? or SSID and password?
WiFiNINA examples have

char ssid[] = SECRET_SSID;        
char pass[] = SECRET_PASS;    

so you add

char ssidCaravan[] = SECRET_SSID_CARAVAN;        
char passCaravan[] = SECRET_PASS_CARAVAN;    

and then you code in setup() to use the 'caravan' credentials if the default didn't connect

Why do you think the caravan and the house have to have different SSIDs and passwords? Make them the same.

Good point. That is a bit of lateral thinking. It means changing a lot of peripherals and some of my IoT devices don't like changing passwords. Will try if coding fails.

Thanks Juraj,
that bit I understand.
But in thingproperties.h there is "WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS); "
and setup "ArduinoCloud.begin(ArduinoIoTPreferredConnection); "
I can't see how to trap the error. The serial port tells me it can't connect, but that error code is hidden from me (I think).

I have a system that does a netscan, allows the user to connect by entering a password and once the connection is successful allows the user to store it in EEPROM.
When restarted it will check do again the netscan and compares to the list of stored networks and if there is a matching ssid will try and connect to it with the password that belongs to it.
Also there is still the possibility to add a new connection to the list.

did you mention iot cloud in your post?

Should I have? I thought IoT 33 implied cloud. How else would I access home and caravan?
Please explain.

I use Blynk service. That allows me to handle the connection to WiFi network. maybe Arduino IoT allows it too but I don't know it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.