1

I am trying to get the NFC shield working using SPI communication. I did follow all the instructions exactly as explained in Seeed Wiki - NFC Shield Setup.

Here is the code I tried:

#include <SPI.h>
#include <PN532/PN532_SPI/PN532_SPI.h>

PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);

void setup(void) {
    Serial.begin(115200); // begin serial communication
    Serial.println("NDEF Reader");
    nfc.begin(); // begin NFC communication
}

void loop(void) {

    Serial.println("\nScan an NFC tag\n");
    if (nfc.tagPresent()) // Do an NFC scan to see if an NFC tag is present
    {
        NfcTag tag = nfc.read(); // read the NFC tag into an object, nfc.read() returns an NfcTag object.

        tag.print(); // prints the NFC tags type, UID, and NDEF message (if available)
    }
    delay(500); // wait half a second (500ms) before scanning again (you may increment or decrement the wait time)
}

Here is the error I am getting.

ResolveLibrary(PN532/PN532/PN532Interface.h)
In file included from D:\Dropbox\Ardruino\Seed NFC Reader\Seeed\ReadTagWithSPI

\ReadTagWithSPI.ino:9:0:
  -> candidates: []

C:\Program Files (x86)\Arduino\libraries\Seeed_Arduino_NFC-master

\src/PN532/PN532_I2C/PN532_I2C.h:9:10: fatal error: PN532/PN532/PN532Interface.h: No such file 

or directory

 #include "PN532/PN532/PN532Interface.h"

          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr

\libraries\SPI 
Using library PN532_SPI in folder: C:\Program Files (x86)\Arduino\libraries\PN532_SPI (legacy)
Using library Seeed_Arduino_NFC-master at version 1.1.0 in folder: C:\Program Files 

(x86)\Arduino\libraries\Seeed_Arduino_NFC-master 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino

\avr\libraries\Wire 
exit status 1
Error compiling for board Arduino Uno.
BSMP
  • 4,596
  • 8
  • 33
  • 44
Johann
  • 29
  • 4

1 Answers1

0

If you are using ArduinoIDE use Sketch -> Manage Libraries ->Library Manager

  • Enter PN532 in the search field and install the lib Adafruit PN532 from there.

This ensures its placed in the right directory. Probably your libs are in a different thanin the Afafruit example.

Codebreaker007
  • 2,911
  • 1
  • 10
  • 22