Hi I am looking for help to understand this question...
I have the MFRC522 code and I will give my card a new UID. But I dont know how to make the coding like this:
#define NEW_UID {0xDE, 0xAD, 0xBE, 0xEF}
I have been searching for a long time and do not understand if this is hex or byte coding Ihave been trying some different converters without luck. Therefore I ask you for help to understand how I can make my own UID somehow. How do I code it and decode it before I give it a new UID like this:0xDE, 0xAD, 0xBE, 0xEF
Sketch: Change UID from library MFRC522
// Set new UID
byte newUid[] = NEW_UID;
if ( mfrc522.MIFARE_SetUid(newUid, (byte)4, true) ) {
Serial.println(F("Wrote new UID to card."));
}
What a #define does is to cause one piece of text within a sketch to be replaced by another. So
#define NEW_UID {0xDE, 0xAD, 0xBE, 0xEF}
says that wherever NEW_UID is in the sketch, except in a string constant, then it should be replaced by {0xDE, 0xAD, 0xBE, 0xEF} before being compiled
So, your original code snippet
byte newUid[] = NEW_UID;
becomes
byte newUid[] = {0xDE, 0xAD, 0xBE, 0xEF} ;
Each byte in the array is represented by a HEX value. If you want to change the value of the new UID then replace the HEX values in the #define with your values
When you see numbers like this that indicates HEX. 0x defines it as HEX then each nibble has a diget 0-F representation the value. Check this link and see if it helps. https://www.youtube.com/watch?v=bt4zavZCrLg