Easiest way to read wifikit esp32 mac address and store in an array

Hi could anyone please give a suggestion how to read the mac address and store in an array please my head is not working at moment
cheers
Pete

I use this code to print the MAC address:

// ----------------------------------- Print MAC Address ----------------------------------
void Mac () {

byte mac[6];
Serial.println();
Serial.print(" MAC Address: “); Serial.println();
WiFi.macAddress(mac);
Serial.print(“MAC: “);
Serial.print(mac[0], HEX);
Serial.print(”:”);
Serial.print(mac[1], HEX);
Serial.print(”:");
Serial.print(mac[2], HEX);
Serial.print(":");
Serial.print(mac[3], HEX);
Serial.print(":");
Serial.print(mac[4], HEX);
Serial.print(":");
Serial.println(mac[5], HEX);
Serial.println();

}

1 Like

Thank you for that code that has resolved the problem
i thought there must be an easy way but i couldnt see it
cheers
pete