helper.ino 345 B

12345678910111213141516
  1. //Get MAC Address of the ESP8266, require WiFi
  2. String MACString;
  3. const char* getMacAddress(){
  4. unsigned char mac[6];
  5. WiFi.macAddress(mac);
  6. MACString = "";
  7. for (int i = 0; i < 6; ++i) {
  8. MACString += String(mac[i], 16);
  9. if (i < 5){
  10. MACString += '-';
  11. }
  12. }
  13. const char* _result = MACString.c_str();
  14. return _result;
  15. }