The RFID reader terminates with a CR, so the bytes are read until a CR is found, and stored as a string
But '$0d' is NOT how to define that terminating character. '\r' or 0x0D or 10 are all suitable ways.
not sure, it works this way
Actually, I was wrong. readBytesUntil() expects three arguments. The first is the character that defines when to stop reading. The second defines where to put the data. The third defines how big the array is that it is to write to (the second argument). The return value is the number of bytes read. That is, in general, useless information. Storing THAT in a String is beyond dumb.
It does NOT work, for any reasonable definition of work.
I did this because you cannot cast a string to unit8_t
Of course not. But, you CAN cast a string to a uint8_t *. You can't cast a String to anything. Get used to the distinction between a string and a String, and use the correct terms.