0

I've set up an Arduino Clone (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

0
Serial.println(WiFi.dnsIP());

If you have more than one DNS server you can specify the index:

Serial.println(WiFi.dnsIP(1));
  • Thanks 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 May 1 at 10:49
  • You're welcome. You can find all the functions in the ESP8266WiFiSTA.h header file. – Majenko May 1 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.