Currently, I am using Circuito to do a project: https://www.circuito.io/app?components=512,9375,9376,11021,761981,761981
First, go to the link above and click on the "CODE" tab, then you should see RFID.h and RFID.cpp. You can download the whole .zip using the button at the bottom too.
I have an issue on C++ in that I am not sure how to retrieve user data from the RFID tag, using Circuito's given RFID .h and .cpp file. The main code provided only gives me how to read an RFID tag's serial, but not user data. I tried reading through the RFID.cpp file, but C++ is not my main strength and I am not quite sure how can I do this. Like which method must I use and how should I pass parameters, etc?
I used https://github.com/miguelbalboa/rfid/blob/master/examples/rfid_write_personal_data/rfid_write_personal_data.ino to write data into RFID tag, writing something like "Product 0001" on "First Name".
Can somebody tell me how to read the user data using Circuito's library? I only want to be able to read back the "Product 0001".
Have you looked at https://github.com/miguelbalboa/rfid/blob/master/examples/rfid_read_personal_data/rfid_read_personal_data.ino (https://github.com/miguelbalboa/rfid/blob/master/examples/rfid_read_personal_data/rfid_read_personal_data.ino)
Thank you for your reply. I have already checked and used https://github.com/miguelbalboa/rfid/blob/master/examples/rfid_read_personal_data/rfid_read_personal_data.ino before posting this topic.
The thing is this. For example, in rfid_read_personal_data.ino, it uses MFRC522.h, while the one provided by Circuito uses its own RFID.h. And I am wiring in Circuito's way, which does not use SPI pins. The code from Github uses SPI pins so I need to use Circuito's implementation in this case.
Let's put it this way:
I see the following methods in RFID.cpp:
* MFRC522Read -> read
* Reading block data
* Input parameters: blockAddr - block address; recvData - read a block of data
* MI_OK Return value: the successful return MI_OK
unsigned char RFID::read(unsigned char blockAddr, unsigned char *recvData)
unsigned char status;
unsigned int unLen;
recvData = PICC_READ;
recvData = blockAddr;
status = MFRC522ToCard(PCD_TRANSCEIVE, recvData, 4, recvData, &unLen);
if ((status != MI_OK) || (unLen != 0x90))
status = MI_ERR;
My guess is that in place of "mfrc522.MIFARE_Read(block, buffer1, &len);" you would use "rfid.read(block, buffer1);"