Hi all
i have arduino mega and #pn532
and i have code to open url in my android phone
the problem when i put phone on pn532
in serial monitor successfully url sent but no action in my phone
any help would be appreciated
#include <Wire.h>
#include <Adafruit_PN532.h>
// Create NFC instance (configure appropriate pins for your setup)
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);
void setup(void) {
Serial.begin(115200);
Serial.println("NFC URL example");
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.print("Didn't find PN53x board");
while (1);
}
// Display chip information
Serial.print("Found chip PN5"); Serial.println((versiondata >> 24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata >> 16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata >>
// Set the NFC board in target mode (to respond to initiators)
nfc.SAMConfig();
Serial.println("Waiting for NFC reader ...");
}
void loop(void) {
uint8_t responseLength = 32;
bool success;
// Wait for a phone or device to be near
success = nfc.inListPassiveTarget();
if (success) {
Serial.println("Found something!");
// Prepare the NDEF message to open Google
uint8_t urlNDEF[] = {
0x03, // NDEF message start
0x0F, // Length of the NDEF message
0xD1, // NDEF Header (Short Record, URI Record Type)
0x01, // Type Length (1 byte)
0x0B, // Payload Length (11 bytes for "http://google.com")
0x55, // Type for URI record
0x01, // URI Identifier (0x01 for "http://")
'g', 'o', 'o', 'g', 'l', 'e', '.', 'c', 'o', 'm' // The URL "google.com"
};
uint8_t response[32];
// Send NDEF message
success = nfc.inDataExchange(urlNDEF, sizeof(urlNDEF), response, &responseLength);
if (success) {
Serial.println("Google URL sent successfully!");
} else {
Serial.println("Failed to send Google URL.");
}
} else {
Serial.println("Didn't find anything!");
}
delay(1000);
}
ok according to pn7160 and 61 there are any recommended app on mobile to communicate with it?
Hi,
PN7160 works as both R/W and CE. Depending on the purpose of your application, you may need to develop an app on the reader side (mobile device) that implements the reading functionality for the card emulation mode of the PN7160.
NFC TagInfo can help you read the meta info and data from RFID and NFC transponders, extract and analyze NFC data sets (NDEF messages), read out and display the complete tag memory layout. However, this app is only for testing purposes.
Regards,
Eduardo.
Hello @user_ahmed
Hope you are doing well.
Please, consider that PN532 is Not Recommended for New Designs; instead, we recommend using PN7160. Also, our support is limited to the resources that are available in PN532 product page.
For Card Emulation mode, perhaps you could refer to AN133910, Section 3.3.8.
Regards,
Eduardo.