找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2030|回复: 3
打印 上一主题 下一主题
收起左侧

求RFID库函数,MFRC522的Arduino库函数

[复制链接]
回帖奖励 25 黑币 回复本帖可获得 5 黑币奖励! 每人限 1 次
跳转到指定楼层
楼主
ID:712171 发表于 2020-4-13 12:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
制作门禁系统,但是看不懂程序,没找到MFEC522的库函数,还请各位大佬能留下
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:933981 发表于 2021-6-7 00:32 | 只看该作者
areduino   ide里面有
回复

使用道具 举报

板凳
ID:808634 发表于 2021-6-7 12:29 | 只看该作者
论坛里应该有
回复

使用道具 举报

地板
ID:155507 发表于 2021-6-7 13:56 | 只看该作者
MFRC522的Arduino函数
  1. /*
  2. *
  3. * All the resources for this project:
  4. * Modified by Aritro Mukherjee
  5. *
  6. *
  7. */

  8. #include <SPI.h>
  9. #include <MFRC522.h>

  10. #define SS_PIN 10
  11. #define RST_PIN 9
  12. MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

  13. void setup()
  14. {
  15.   Serial.begin(9600);   // Initiate a serial communication
  16.   SPI.begin();      // Initiate  SPI bus
  17.   mfrc522.PCD_Init();   // Initiate MFRC522
  18.   Serial.println("Approximate your card to the reader...");
  19.   Serial.println();

  20. }
  21. void loop()
  22. {
  23.   // Look for new cards
  24.   if ( ! mfrc522.PICC_IsNewCardPresent())
  25.   {
  26.     return;
  27.   }
  28.   // Select one of the cards
  29.   if ( ! mfrc522.PICC_ReadCardSerial())
  30.   {
  31.     return;
  32.   }
  33.   //Show UID on serial monitor
  34.   Serial.print("UID tag :");
  35.   String content= "";
  36.   byte letter;
  37.   for (byte i = 0; i < mfrc522.uid.size; i++)
  38.   {
  39.      Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
  40.      Serial.print(mfrc522.uid.uidByte[i], HEX);
  41.      content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
  42.      content.concat(String(mfrc522.uid.uidByte[i], HEX));
  43.   }
  44.   Serial.println();
  45.   Serial.print("Message : ");
  46.   content.toUpperCase();
  47.   if (content.substring(1) == "BD 31 15 2B") //change here the UID of the card/cards that you want to give access
  48.   {
  49.     Serial.println("Authorized access");
  50.     Serial.println();
  51.     delay(3000);
  52.   }

  53. else   {
  54.     Serial.println(" Access denied");
  55.     delay(3000);
  56.   }
  57. }
复制代码



MFRC522-1.4.8.zip

1.16 MB, 下载次数: 18

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表