Convert byte array MAC address to String

So I have my particle getting its own MAC Address, and I am wondering how to convert it to a String.

My code so far:

byte photonMacAdress[6];

void setup() { 

  WiFi.macAddress(photonMacAddress);
}

So if I understand this code correctly so far, after WiFi.macAddress(), the mac address of the photon should now be stored in the byte array. Now if I wanna convert this into a string of the whole MAC address, then I need to convert each byte to its hexadecimal value then add a “:” in between the values.

Where I am stuck is how do I convert each byte into their hexadecimal value?

How about the solution shown in the docs?
https://docs.particle.io/reference/firmware/photon/#macaddress-

1 Like

snprintf() is the key to the riddle.

1 Like