I need the unique address I get from UniqueID8 in an array like the array test in this code.
After much searching and trying I ended up writing this code: it is not not working very well and the result is a string.
The output from UniqueID8dump(Serial); is:
UniqueID: 33 39 51 13 38 38 35 38
output from temp=id2CharArray(UniqueID8):
33 39 51 13 00 00
So the last two bytes are lost.
#include <UIPEthernet.h>
#include <ArduinoUniqueID.h>
#include <Arduino.h>
char test[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
char* temp;
char* id2CharArray(IPAddress id) {
static char a[32];
sprintf(a, "%02X %02X %02X %02X %02X %02X", id[0], id[1], id[2], id[3], id[4], id[5]);
return a;
}
void setup()
{
Serial.begin(115200);
UniqueID8dump(Serial);
Serial.println("output from temp=id2CharArray(UniqueID8):");
temp=id2CharArray(UniqueID8);
Serial.println(temp);
}
void loop()
{
}
Any help getting this into working code would be much appreciated.