Thursday, June 6, 2024
HomeiOS Developmentios - NFC - android / iphone - Figuring out Cellphone to...

ios – NFC – android / iphone – Figuring out Cellphone to PN532 NFC Reader


I am working with an ESP32 and a PN532 NFC tag reader, and I’ve efficiently used the code beneath to learn NFC tags.

Nonetheless, I’d wish to establish a telephone (Android/iPhone) by inserting it close to the PN532.

I wish to construct an iOS/Android app that sends a identical NFC knowledge every time, as at the moment, Android sends a unique ID each time a telephone is positioned close to the PN532.

Is there a means, or do you might have any strategies, on how I can use a telephone to ship an ID or some constant knowledge to the PN532 so I can establish that it is my telephone and carry out a particular activity primarily based on that?

I would like one thing much like what’s proven on this video:
https://youtu.be/_kW7hPiGi2o?t=27 However I’m unsure how the telephone sends
the identical ID. My Android telephone sends a unique ID every time, and my
iPhone would not ship something.

#embrace <Wire.h>
#embrace <PN532_I2C.h>
#embrace <PN532.h>

PN532_I2C pn532i2c(Wire);
PN532 nfc(pn532i2c);

void setup() {
    nfc.start();
    nfc.setPassiveActivationRetries(0x02);
    nfc.SAMConfig();
}

void loop() {
    uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
    uint8_t uidLength;
 
    if (nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength, 100)) {
        String hexString = "";
        for (int i = 0; i < uidLength; i++) {
            hexString += String(uid[i] >> 4, HEX);
            hexString += String(uid[i] & 0x0F, HEX);
        }
        Serial.print(hexString);
    }
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments