I am using the RFID module to read mifare NFC chips and the library has only methods to send the data to the serial monitor. I need them to be saved to an SD card file. I have been adding custom methods to the library files to return strings that I then write to the SD card but this is a pain; there must be a quicker way to simply pipe all the data automatically but I do not know how to do this in cpp.
Here is an example of the function to dump to serial, that needs to be piped to the file on the SD card.
void MFRC522::PICC_DumpDetailsToSerial(Uid *uid) {
Serial.print(F("Card UID:"));
for (byte i = 0; i < uid->size; i++) {
if(uid->uidByte[i] < 0x10)
Serial.print(F(" 0"));
else
Serial.print(F(" "));
Serial.print(uid->uidByte[i], HEX);
}
Serial.println();
// SAK
Serial.print(F("Card SAK: "));
if(uid->sak < 0x10)
Serial.print(F("0"));
Serial.println(uid->sak, HEX);
// (suggested) PICC type
PICC_Type piccType = PICC_GetType(uid->sak);
Serial.print(F("PICC type: "));
Serial.println(PICC_GetTypeName(piccType));
}
Thanks!