Sucareto / Arduino-Aime-Reader

使用 Arduino 制作的 Aime 兼容读卡器。
224 stars 35 forks source link

'D4' was not declared in this scope #18

Closed wjjsn closed 6 days ago

wjjsn commented 1 week ago

C:\Users\Administrator\Downloads\Arduino-Aime-Reader-main\tools\ReaderTest\ReaderTest.ino:10:17: note: '#pragma message: 当前的开发板是 ESP8266' 10 | #pragma message "当前的开发板是 ESP8266" | ^~~~~~~~ C:\Users\Administrator\Downloads\Arduino-Aime-Reader-main\tools\ReaderTest\ReaderTest.ino:28:17: note: '#pragma message: 使用 SPI 连接 PN532' 28 | #pragma message "使用 SPI 连接 PN532" | ^~~~~ C:\Users\Administrator\Downloads\Arduino-Aime-Reader-main\tools\ReaderTest\ReaderTest.ino:12:22: error: 'D4' was not declared in this scope 12 | #define PN532_SPI_SS D4 | ^~ C:\Users\Administrator\Downloads\Arduino-Aime-Reader-main\tools\ReaderTest\ReaderTest.ino:30:22: note: in expansion of macro 'PN532_SPI_SS' 30 | PN532_SPI pn532(SPI, PN532_SPI_SS); | ^~~~

exit status 1

Compilation error: 'D4' was not declared in this scope ESP8266和PN532按照D4-SS,D5-SCK,D6-MISO,D7-MOSI连接

Sucareto commented 1 week ago

在 Arduino IDE 内选择的是哪个开发板型号呢? 对于 ESP8266,我选择的是NodeMCU 1.0 (ESP-12E Module)D4是可以正常使用的。 参考 nodemcu/pins_arduino.h 如果是其他型号,如Generic ESP8266 Modulegeneric/pins_arduino.h,是没有D4的。

wjjsn commented 1 week ago

我不知道开发板型号怎么选,还请您详细说一下

Sucareto commented 1 week ago

打开 Arduino IDE 后,在菜单栏找到: 工具 -> 开发板 -> esp8266 -> NodeMCU 1.0 (ESP-12E Module) 可以参考这个:Arduino IDE 配置为 ESP8266 开发环境的方法

另外一不小心摸到你的 csdn 了( 隐藏 amdaemon 窗口的最简单方法: inject -k mai2hook.dll amdaemon.exe -f -c config_common.json config_server.json config_client.json 其他被 segatools inject 的程序也同理,去掉-d参数就可以隐藏那个窗口了。

wjjsn commented 1 week ago

感谢您的指点,我的意思是不太明白这么选开发板的原理。 关于隐藏的那个我是真不知道,没想到这么简单,我这绕了两个超级大圈子啊

Sucareto commented 1 week ago

ESP8266 是芯片型号,而各种开发板基于 ESP8266 做了各种不同封装开发板,它们的针脚布局可能不相同。 所以要选择合适的型号,才能对应上针脚定义。 例如这是一份NodeMCU 1.0 (ESP-12E Module)的针脚图,里面定义了D4,也叫GPIO2。 这个GPIO2是 ESP8266 的,D4NodeMCU 1.0 (ESP-12E Module)的。 NODEMCU_DEVKIT_V1 0_PINMAP 所以 nodemcu/pins_arduino.h 写了以下内容:

static const uint8_t D4   = 2;

如果是其他开发板型号,可能就没有D4这个针脚定义。

wjjsn commented 1 week ago

明白了!我还想问问第四步:上传 ReaderTest 后如何测试硬件是否工作正常

wjjsn commented 1 week ago

我好像知道了是不是打开串口监视器波特率选115200?然后还有一个问题是esp 8266只能走spi吗?因为我用i2c提示Didn't find PN53x board

Sucareto commented 1 week ago

测试硬件是否工作正常: 检查串口输出,确认 PN532 是否初始化成功,刷卡检查是否正确读出卡片类型信息。

Didn't find PN53x board 的情况: 断电后,检查 PN532 上面的拨码开关,是否正确设置为 SPI 模式,检查接线是否正确。

wjjsn commented 1 week ago

我选择 i2c,按照D1-SDA,D2-SCL接线 ,拨码1on2off依然Didn't find PN53x board

Sucareto commented 1 week ago

这个就需要根据你的硬件环境慢慢测试啦~ 检查线的连接是否正常,针脚是否插对之类的~

wjjsn commented 6 days ago

还有一个问题:我按照i2c的接线,但是刷入时提示使用 SPI 连接 PN532。是否是因为这个导致无法使用

Sucareto commented 6 days ago

是的,需要注释 #define PN532_SPI_SS D4 这行,才会转为使用 i2c 的连接方式。

wjjsn commented 6 days ago

非常感谢!做好了(就应该早点说这个,等我有时间了做个视频教程吧(目前还没看到有),不然总会有像我这样的人懵逼半天弄不好。然后吧,那个-d删掉了之后不知道我这里为什么就不能正常启动了