| 24 | } |
| 25 | |
| 26 | void scanNfc(uint8_t scannerPin) |
| 27 | { |
| 28 | if(!mfrc522.PICC_IsNewCardPresent()) { |
| 29 | Serial << _F("Scanning NFC pin #") << scannerPin << _F(" not present") << endl; |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | // Select one of the cards |
| 34 | if(!mfrc522.PICC_ReadCardSerial()) { |
| 35 | Serial << _F("Selecting card #") << scannerPin << _F(" failed...") << endl; |
| 36 | } else { |
| 37 | // Show some details of the PICC (that is: the tag/card) |
| 38 | Serial << _F("Card UID on scanner: ") << scannerPin << endl; |
| 39 | m_printHex("UID", mfrc522.uid.uidByte, mfrc522.uid.size); |
| 40 | } |
| 41 | |
| 42 | mfrc522.PICC_HaltA(); |
| 43 | |
| 44 | // Stop encryption on PCD |
| 45 | mfrc522.PCD_StopCrypto1(); |
| 46 | mfrc522.PCD_Init(); |
| 47 | } |
| 48 | |
| 49 | } // namespace |
| 50 |
no test coverage detected