88 - Connect to WiFi with strongest signal (RSSI)
99 - Fall back to connect to next WiFi when a connection failed or lost
1010 - Fall back to connect to hidden SSID's which are not reported by WiFi scan
11- - Static IP assigned depending on which SSID is connected
11+ - Connect to WiFi using a static IP configuration
1212
1313 To enable debugging output, select in the Arduino iDE:
1414 - Tools | Debug Port: Serial
@@ -37,13 +37,14 @@ void setup() {
3737 wifiMulti.addAP (" ssid_from_AP_2" , " your_password_for_AP_2" );
3838 wifiMulti.addAP (" ssid_from_AP_3" , " your_password_for_AP_3" );
3939
40- wifiMulti.onSSIDSelected (connectedToSSID);
40+ // Register custom SSID callback
41+ wifiMulti.onSSIDSelected (onSSIDSelected);
4142
42- // More is possible
43+ // Insert more sketch code
4344}
4445
45- void connectedToSSID (const char *ssid) {
46- // On connecting to the second AP, assign static IP using config(...).
46+ void onSSIDSelected (const char *ssid) {
47+ // Before connecting to the second AP, assign static IP using config(...).
4748 if (strcmp (ssid, " ssid_from_AP_2" ) == 0 ) {
4849 IPAddress ip2 (192 , 168 , 1 , 123 );
4950 IPAddress gw2 (192 , 168 , 1 , 1 );
@@ -52,7 +53,7 @@ void connectedToSSID(const char *ssid) {
5253 return ;
5354 }
5455
55- // For other SSID DHCP will be used.
56+ // Make sure that DHCP is used for other networks .
5657 WiFi.config (0U , 0U , 0U );
5758}
5859
0 commit comments