diff --git a/rfid/rfid.ino b/rfid/rfid.ino index 757b6aa..3f8536c 100644 --- a/rfid/rfid.ino +++ b/rfid/rfid.ino @@ -104,7 +104,13 @@ boolean getID() for ( uint8_t i = 0; i < 4; i++) { //readCard[i] = mfrc522.uid.uidByte[i]; // Adds the 4 bytes in a single String variable - tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); + uint8_t value = mfrc522.uid.uidByte[i]; + // Checks to see if the value is smaller + // than 16 (0x10) and adds the 0 padding needed if needed + if (value<0x10) { + tagID.concat("0"); + } + tagID.concat(String(value, HEX)); } //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM tagID.toUpperCase(); @@ -112,3 +118,4 @@ boolean getID() return true; //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM } +