I have a byte array of 6 elements which contains the MAC address of a WiFi chip. How do I convert this into a single value. For e.g. If the array is:
mac[0] = 208
mac[1] = 181
mac[2] = 194
mac[3] = 193
mac[4] = 114
mac[5] = 219
How do I get a value like this: 208181194193114219 which in representation is essentially all the digits concatenated.
I tried AND'ing the individual mac IDs with 0xFFh and then bit-shifted them to the left but I see a value of 3250763216. This is the code:
uint32_t deviceID = 0;
for (int i = 0; i < 6; i++)
{
deviceID += (mac[i] & 0xFFh) << (8 * i);
}
Serial.print("Device ID : "); Serial.println(deviceID);