WiFi.config format is not correct

ForumCategory: esp32WiFi.config format is not correct
Tim asked 3 weeks ago

The format of WiFi.config in the code above is incorrect:

WiFi.config(ip, dns, gateway, subnet);

It should be:

WiFi.config(staticIP, gateway, subnet, dns, dns)

The format given above does indeed correctly set the static IP correctly. However, the remaining values are set incorrectly. This can be demonstrated by including these lines after the Wifi.config statement:

Serial.print("connected as: ");
Serial.println(WiFi.localIP());
Serial.print("Subnet Mask: ");
Serial.println(WiFi.subnetMask());
Serial.print("Gateway IP: ");
Serial.println(WiFi.gatewayIP());
Serial.print("DNS 1: ");
Serial.println(WiFi.dnsIP(0));
Serial.print("DNS 2: ");
Serial.println(WiFi.dnsIP(1));
Click to rate this post!
[Total: 0 Average: 0]
Do NOT follow this link or you will be banned from the site!
DIY Projects