I have the problem, that my NFC Module V3 by ELECHOUSE slows down the program after about one minute of the program running.
I have already tried lots of stuff and can't seem to find a solution.
Any help is appreciated
Heres the code regarding the NFC stuff.
#include <Adafruit_PN532.h>
// define values for the NFC reader
uint16_t timeout = 100;
uint8_t knownUID[] = {0x04, 0x1E, 0x6D, 0x89, 0x78, 0x00, 0x00};
uint8_t knownUIDLength = sizeof(knownUID) / sizeof(knownUID[0]);
unsigned int lastNFCCheck = 0;
unsigned int nfcInterval = 1000; // Check NFC every 1000ms
Adafruit_PN532 nfc(2, 3, &Wire);
void readNFC() {
// only check in certain intervals
if (millis() - lastNFCCheck >= nfcInterval) {
lastNFCCheck = millis();
uint8_t uid[7];
uint8_t uidLength;
// read NFC
if (nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, timeout)) {
Serial.print("UID: ");
for (uint8_t i = 0; i < uidLength; i++) {
if (uid[i] < 0x10) Serial.print("0");
Serial.print(uid[i], HEX);
if (i < uidLength - 1) Serial.print(":");
}
Serial.println();
// compare with known UID and authenticate user
authenticateUser(uidLength == knownUIDLength && compareUIDs(uid, knownUID, uidLength));
}
}
}
void setup() {
nfc.begin();
if (nfc.getFirmwareVersion()) {
nfc.SAMConfig();
Serial.println("NFC Ready");
}
}
void loop(){
readNFC();
}