RFID- How to detect when a card is removed from the reader

Hey Guys,
I am wroking with rfid mfrc522 readers. I am using 4 readers for my project and they all read data as they should when I scan the tags.
I use this to detect when the reader has started reading:

if (rfidReader0.PICC_IsNewCardPresent() && rfidReader0.PICC_ReadCardSerial()) {
    Serial.println("new card detected");
    isreading0 = true;
    readOnReader0(); 
  }

But how can I check if the reader is still reading that card or has stopped?

Thanks!

test that the card is present, readed and has the same serial as previous read

@b707 Can you please explain a little bit more, how I can check if it has the same serial?
Thanks!

When you call PICC_ReadCard_Serial() it returns true if a card is present and false if is not. You can spot when a card is removed if between one call and the next the return value changes from true to false

Read the card serial (see the ReadNUID.ino example from the library) and save it in variable. At next reading do the same and compare actual and saved ID

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.