Created
February 14, 2017 08:05
-
-
Save mojiAh/a204d32f5979dd724525682da1de9a48 to your computer and use it in GitHub Desktop.
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
#include <ESP8266WiFi.h> | |
void setup() { | |
Serial.begin(115200); | |
String clientMac = ""; | |
unsigned char mac[6]; | |
WiFi.macAddress(mac); | |
clientMac += macToStr(mac); | |
Serial.println(); | |
Serial.println(clientMac); | |
} | |
String macToStr(const uint8_t* mac){ | |
String result; | |
for (int i = 0; i < 6; ++i) { | |
result += String(mac[i], 16); | |
if (i < 5) | |
result += ':'; | |
} | |
return result; | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment