Arduino &引用;没有此类文件错误“;导入PN532Interface.h时

Arduino &引用;没有此类文件错误“;导入PN532Interface.h时,arduino,nfc,spi,arduino-ide,pn532,Arduino,Nfc,Spi,Arduino Ide,Pn532,我正在尝试使用SPI通信使NFC屏蔽正常工作。 我确实完全按照中的说明进行了操作 以下是我尝试的代码: #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 seria

我正在尝试使用SPI通信使NFC屏蔽正常工作。 我确实完全按照中的说明进行了操作

以下是我尝试的代码:

#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)
}

如果使用ArduinoIDE,请使用
Sketch->Manage Libraries->Library Manager

  • 在搜索字段中输入PN532,然后从那里安装lib
    Adafruit PN532

这样可以确保将其放置在正确的目录中。可能您的LIB与Afruit示例中的不同。

如果您使用ArduinoIDE,请使用
Sketch->Manage Libraries->Library Manager

  • 在搜索字段中输入PN532,然后从那里安装lib
    Adafruit PN532

这样可以确保将其放置在正确的目录中。可能您的LIB与Afruit示例中的不同。

错误信息非常清楚。您丢失了一个文件,所以我猜您忘记执行步骤3了?您是否有文件清楚地显示丢失了?它在你的计算机上的什么地方?错误信息非常清楚。您丢失了一个文件,所以我猜您忘记执行步骤3了?您是否有文件清楚地显示丢失了?你的电脑在哪里?
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.