Skip to content

Instantly share code, notes, and snippets.

@mojiAh
Created February 14, 2017 08:05
Show Gist options
  • Save mojiAh/a204d32f5979dd724525682da1de9a48 to your computer and use it in GitHub Desktop.
Save mojiAh/a204d32f5979dd724525682da1de9a48 to your computer and use it in GitHub Desktop.
#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