My PN532 runs the following code;
setup...
#include <SPI.h>
#include <PN532_SPI.h>
#include "PN532.h"
with the loop being....
nfc.begin();
nfc.setPassiveActivationRetries(0x01);
nfc.SAMConfig();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
if (success) {
Serial.println("Found a card!");
for (uint8_t i = 0; i < uidLength; i++)
{
// Serial.print(" 0x");Serial.print(uid[i], HEX);
}
}
}
It runs and I have seen a thread that suggests modifying the PN532.h file to reduce the timeout and help speed .....
bool readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength, uint16_t timeout = 0); //timeout 0 means no timeout - will block forever.
This seems to have an affect but from my setup, how do i know I am changing the correct file? I am not sure what #include "PN532.h" refers to?
I have Adafruit PN532 library folders and Adafruit PN532 library folders and I am not sure what is being used?
In addition, I have seen other sketches that put .....
nfc.begin();
nfc.setPassiveActivationRetries(0x01);
nfc.SAMConfig();
All in Setup but if I do that the PN532 isnt recognised.