Lliam
February 7, 2017, 1:24am
#1
uint8_t uid[] = { 0x04, 0x7E, 0x0B, 0x72, 0x44, 0x34, 0x84 };
void setup() {
Serial.begin(115200);
delay(500);
This is a problem I have no clue how to tackle. Basically, I would like to turn the UID array into a non array integer variable of a string.
What I would like to do is
Serial.print(stringVariable);
out >> 047EOB72443484
or
Serial.print(intVariable);
out >> 4126111146852132 (decimal representation of the hex)
but I have no clue where or how to start
Delta_G
February 7, 2017, 1:29am
#2
Serial.print each byte individually if you want it in hex. If you want the decimal representation then you're going to have to do some math.
Serial.print(uid[0]);
Serial.print(uid[1]);
Serial.print(uid[2]);
//...etc...
system
February 7, 2017, 1:31am
#3
sprintf. Also does your leading zeroes for you.
It's a sledgehammer to crack a nut though
system
February 7, 2017, 10:29am
#4
Basically, I would like to turn the UID array into a non array integer variable of a string.
Why? It is trivial to compare arrays. Turning the array of bytes into something else for printing, storing in EEPROM, or comparing will NOT make the job easier.