Created
July 23, 2021 15:00
-
-
Save netskink/f54cc0767e788058385ea3f3b7ba0c77 to your computer and use it in GitHub Desktop.
wifi101 ip and mac address dump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setupWifi() { | |
Serial.println("Starting wifi"); | |
WiFi.begin(ssid, password); | |
Serial.println("Connecting to WiFi"); | |
while (WiFi.status() != WL_CONNECTED) { | |
delay(100); | |
} | |
Serial.println("Waiting on time sync..."); | |
while (WiFi.getTime() < 1510644967) { | |
delay(10); | |
} | |
// JFD | |
// WiFi101.h has this for the WiFiClass | |
//localIP() | |
// This prints the raw integer representation of IP | |
Serial.println(WiFi.localIP()); | |
// This prints dotted decimal for loopback address | |
Serial.println(IPAddress(0x7F000001)); | |
// This prints the assigned dhcp address in dotted decimal | |
Serial.println(IPAddress(WiFi.localIP())); | |
uint8_t mac[6]; | |
WiFi.macAddress(mac); | |
Serial.print("MAC: "); | |
Serial.print(mac[5],HEX); | |
Serial.print(":"); | |
Serial.print(mac[4],HEX); | |
Serial.print(":"); | |
Serial.print(mac[3],HEX); | |
Serial.print(":"); | |
Serial.print(mac[2],HEX); | |
Serial.print(":"); | |
Serial.print(mac[1],HEX); | |
Serial.print(":"); | |
Serial.println(mac[0],HEX); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment