标题:
求RFID库函数,MFRC522的Arduino库函数
[打印本页]
作者:
会好的
时间:
2020-4-13 12:01
标题:
求RFID库函数,MFRC522的Arduino库函数
制作门禁系统,但是看不懂程序,没找到MFEC522的库函数,还请各位大佬能留下
作者:
dfghjkljhgf
时间:
2021-6-7 00:32
areduino ide里面有
作者:
七禾页
时间:
2021-6-7 12:29
论坛里应该有
作者:
angmall
时间:
2021-6-7 13:56
MFRC522的Arduino函数
/*
*
* All the resources for this project:
* Modified by Aritro Mukherjee
*
*
*/
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println("Approximate your card to the reader...");
Serial.println();
}
void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "BD 31 15 2B") //change here the UID of the card/cards that you want to give access
{
Serial.println("Authorized access");
Serial.println();
delay(3000);
}
else {
Serial.println(" Access denied");
delay(3000);
}
}
复制代码
MFRC522-1.4.8.zip
2021-6-7 13:56 上传
点击文件名下载附件
1.16 MB, 下载次数: 18
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1