The helper function printDec() in the NUID.ino example file has a cut and paste error from the HEX version. You don't want a leading zero if the value is above 0x10.
/**
Helper routine to dump a byte array as dec values to Serial.
/
void printDec(byte buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], DEC);
}
}
Affected file(s) or example(s):
Filename 1
Filename 2
Steps to reproduce:
Observed Results:
if the uid happens to be 9, 15, 16, 240, you get the output
" 09 015 16 240"
Expected Results:
I would expect a 3 digit value for each byte 000 to 255 or at least consistent leading white space
" 009 015 016 240" or
" 9 15 16 240"
Relevant Code:
* Helper routine to dump a byte array as dec values to Serial.
*/
void printDec(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], DEC);
}
}
Step 1: Describe your environment
Step 2: Describe the problem
The helper function printDec() in the NUID.ino example file has a cut and paste error from the HEX version. You don't want a leading zero if the value is above 0x10. /**
Affected file(s) or example(s):
Steps to reproduce:
Observed Results:
if the uid happens to be 9, 15, 16, 240, you get the output " 09 015 16 240"
Expected Results:
I would expect a 3 digit value for each byte 000 to 255 or at least consistent leading white space " 009 015 016 240" or " 9 15 16 240"
Relevant Code: