9401| 4
|
[进阶] 串口NFC库,适用于PN532 |
库文件地址: https://github.com/rainbowyu/LD_ArduinoLib/tree/V1.01 基本使用方法介绍: [mw_shl_code=applescript,true]#include "LD_NFClib.h" unsigned char dataWriteIntoCard[16]={0x01,0x01,0x02,0x02,0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x07,0x07,0x08,0x08}; unsigned char UID[4]={0xD1,0xAA,0x40,0xEA}; unsigned char secret[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; LD_NFC myNFC(&Serial1,&Serial); void setup() { Serial.begin(9600); Serial1.begin(115200); delay(3000); myNFC.wakeUp(); } int ctr=0; void loop() { myNFC.scan(); if(myNFC.passWordCheck(0x08,UID,secret)==1) { Serial.println("passed"); if(ctr<4) { myNFC.writeData(0x08,dataWriteIntoCard); Serial.println("written"); ctr++; } delay(2000); myNFC.readData(0x08); } delay(4000); } [/mw_shl_code] 使用步骤: 1、每次上电需要唤醒。 2、扫描卡。 3、密码查询。 4、写卡或者读卡。4个区用1个密码,换区之后需要重新验证密码。 库现在支持功能很少,只有基本功能。。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed