这是我尝试的代码:
#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)
}
这是我遇到的错误。
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.
我正在尝试使用SPI通信来使NFC屏蔽正常工作。我确实按照Seeed Wiki-NFC Shield设置中的说明完全遵循了所有说明。这是我尝试的代码:#include
Sketch -> Manage Libraries ->Library Manager