How to use WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);


My Arduino IoT Cloud project is not connecting to my WiFi access point. It's an open network without a password.

In the Web Editor Monitor I get the following messages:

Connection to "linksys" failed
Retrying in "500" milliseconds
Connection to "linksys" failed
Retrying in "500" milliseconds

How do I use "WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS);" without a password.


the parameters in the WiFiConnectionHandler are later used for calling   WiFi.begin(_ssid, _pass);

have you tried passing "" for the password ? the length (strlen(passphrase) is used) will be 0 and hopefully the WiFiDrv::wifiSetPassphrase() call will do the right thing

it's unfortunate they coded it this way as   WiFi.begin(_ssid);is the proper way to handle open wireless network.

--> you could edit the library to add one method with the limited signature and duplicate the other code (set _pass to NULL maybe or "") but just call WiFi.begin(_ssid); instead of WiFi.begin(_ssid, _pass);

(there might be other modifications if _pass is used elsewhere - I have not checked)

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, ""); worked

const char PASS = "";
WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS); worked

WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, NULL); did not work

Thank you for your help.

Good to know
Have fun!