I've set up an ESP8266 (Wemos D1 Mini) to get IP-information via DHCP. Everything works fine and I can print the information :
Serial.print(WiFi.macAddress()); Serial.print(WiFI.localIP()); Serial.print(WiFi.subnetMask()); Serial.print(WiFi.gateway.IP());
But how do I print the DNS-address ??
I cant find a function for this ???
/Kind regards : Gurra
-
arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/…Juraj– Juraj ♦2019年05月01日 09:17:04 +00:00Commented May 1, 2019 at 9:17
1 Answer 1
Serial.println(WiFi.dnsIP());
If you have more than one DNS server you can specify the index:
Serial.println(WiFi.dnsIP(1));
answered May 1, 2019 at 9:15
-
1Thanks Majenko, i've Googled this question and found answers to ip, netmask, mac & gateway but not DNS, so you saved me hours of extra work by this....So I am very grateful !!Rhino– Rhino2019年05月01日 10:49:19 +00:00Commented May 1, 2019 at 10:49
-
1You're welcome. You can find all the functions in the ESP8266WiFiSTA.h header file.Majenko– Majenko2019年05月01日 10:58:34 +00:00Commented May 1, 2019 at 10:58