Arduino IDE 1.8.4
The following does not get a DHCP address. It returns 192.168.4.1:
wifiMulti.addAP("George", "Pass1"); yield();
wifiMulti.addAP("makerspace-2.4", "Pass2"); yield();
...
while (wifiMulti.run() != WL_CONNECTED) {
delay(1000);
Serial.print('.');
}
Serial.print("Connected to\t"); Serial.println(WiFi.SSID()); // Tell us what network we're connected to
Serial.print("IP address:\t"); Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
Serial.println("WiFi connected"); yield(); // HOORAY!!!
The following does get a DHCP address:
const char* ssid = "George";
const char* password = "Pass1";
...
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
I really would like to have a DHCP address. Both programs compiled on the same laptop, same network, same ESP hardware. Only change was from WiFi to WiFiMulti.
Mike