i try to send text from PHONE via "NFC TOOL app" using PN532(i2c) but i cant read it in esp
#include <Wire.h>
#include <Adafruit_PN532.h>
#define PN532_IRQ (2)
#define PN532_RESET (3)
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);
void setup(void) {
Serial.begin(9600);
Serial.println("Hello!");
// Initialize PN532 module
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.println("Didn't find PN53x board");
while (1); // halt
}
// Configure board to read RFID tags
nfc.SAMConfig();
Serial.println("Waiting for an NFC tag ...");
}
void loop(void) {
uint8_t success;
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)
// Wait for an NFC tag
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
Serial.println("Found an NFC tag!");
Serial.print("UID Length: ");
Serial.print(uidLength, DEC);
Serial.println(" bytes");
Serial.print("UID Value: ");
for (uint8_t i = 0; i < uidLength; i++) {
Serial.print(" 0x");
Serial.print(uid[i], HEX);
}
Serial.println("");
// Read data blocks containing text message from the NFC tag
uint8_t blockNumber = 4; // Adjust the block number where your text message is stored
uint8_t data[16]; // Buffer to store the read data
success = nfc.ntag2xx_ReadPage(blockNumber, data);
if (success) {
Serial.println("Data read from NFC tag:");
Serial.write(data, 16);
Serial.println("");
} else {
Serial.println("Failed to read data from NFC tag");
}
delay(1000);
}
}
i get this
Found an NFC tag!
UID Length: 4 bytes
UID Value: 0x8 0x47 0xC3 0xED
Failed to read data from NFC tag
i want a way so that i can get an ID or something that i can identify the phone not a random UID every time
