Hey, I want to use PN532 as a card emulator so I can send data from an Android phone to the Arduino
Now, I followed this tutorial Interfacing PN532 NFC RFID Module with Arduino and I am starting to learn about it
I tested the C2L and HSU and I got the uid
But when I try to use SPI I am getting PN532 not found
I connected the PN532 to those pins
- VCC (Power supply) <-> 5V
- RST (Reset) <-> 9
- GND (Ground) <-> GND
- MISO (Master Input Slave Output) <-> 11
- MOSI (Master Output Slave Input) <-> 12
- SCK (Serial Clock) <-> 13
- SS (Slave select) <-> 10
And I set the communication mode to SPI
and the code that I used is
for SPI Communication
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>
PN532_SPI interface(SPI, 10); // create a PN532 SPI interface with the SPI CS terminal located at digital pin 10
NfcAdapter nfc = NfcAdapter(interface); // create an NFC adapter object
String tagId = "None";
void setup(void)
{
Serial.begin(115200);
Serial.println("System initialized");
nfc.begin();
}
void loop()
{
readNFC();
}
void readNFC()
{
if (nfc.tagPresent())
{
NfcTag tag = nfc.read();
tag.print();
tagId = tag.getUidString();
}
delay(5000);
}
Any tips on what I can try?