0

Card removal detection during serial input
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Card removal detection during serial input

by martic on Fri Oct 19, 2018 11:05 am

Dear all,

I'm trying to do a quite simple stuff.

I want to detect a card, then wait for some instruction through the serial interface, and execute those requests on the tag.
If the tag is removed, whatever a serial action is on-going or not, I have to restart for the detection.

However when I'm using the "nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);" function (with a timeout done by a maximum retry), the function failed if the card is still on the reader.

So the question is how can I break the serial read loop at the card removal or anyway create a loop with those 2 constraints (NFC + serial read)?

The flow would be something like



1) Wait for a card to be detected
2) Wait for Serial input or card removal
3.1) If card removal, stop the loop and go to the first step (1)
3.2) If Serial input - decode the input and execute the command - stay on the loop


Thank you

martic
 
Posts: 1
Joined: Fri Oct 19, 2018 10:56 am

Please be positive and constructive with your questions and comments.