arduino - 导入 PN532Interface.h 时出现“没有此类文件错误”
问题描述
我正在尝试使用 SPI 通信使 NFC 屏蔽工作。我确实按照 Seeed Wiki-NFC Shield Setup中的说明完全按照说明进行操作。
这是我尝试过的代码:
#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.
解决方案
如果您使用的是 ArduinoIDE,请使用Sketch -> Manage Libraries ->Library Manager
- 在搜索字段中输入 PN532 并
Adafruit PN532
从那里安装 lib。
这样可以确保将其放置在正确的目录中。可能您的库与 Afafruit 示例中的不同。
推荐阅读
- angular - Angular 7.2.5 将订阅分配给 EventEmitter 失败错误 TS2740
- python - 如何从字符串中的特定单词开始提取文本?
- python - 我可以使用字典本身中的 for 循环直接在字典中定义一个值吗?
- c# - EmguCV C# - 拆分后合并 hsv 通道
- ios - 当应用程序在后台时,iOS 中的 Ionic3 无法将坐标流式传输到我的 API
- java - 十进制值以科学计数法显示 - HBase (Phoenix)
- c++ - for_each 算法导致 basic_string::_M_construct null 在 C++ 中无效
- scala - Scala 数字类型的隐式转换是否特殊?
- bash - 在从“find | xargs”运行的命令中使用参数扩展来防止输出覆盖
- php - 内网 PHP 页面上的文件 URL “不允许加载本地资源”