找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 2017|回復(fù): 3
收起左側(cè)

求RFID庫(kù)函數(shù),MFRC522的Arduino庫(kù)函數(shù)

[復(fù)制鏈接]
回帖獎(jiǎng)勵(lì) 25 黑幣 回復(fù)本帖可獲得 5 黑幣獎(jiǎng)勵(lì)! 每人限 1 次
ID:712171 發(fā)表于 2020-4-13 12:01 | 顯示全部樓層 |閱讀模式
制作門(mén)禁系統(tǒng),但是看不懂程序,沒(méi)找到MFEC522的庫(kù)函數(shù),還請(qǐng)各位大佬能留下
回復(fù)

使用道具 舉報(bào)

ID:933981 發(fā)表于 2021-6-7 00:32 | 顯示全部樓層
areduino   ide里面有
回復(fù)

使用道具 舉報(bào)

ID:808634 發(fā)表于 2021-6-7 12:29 | 顯示全部樓層
論壇里應(yīng)該有
回復(fù)

使用道具 舉報(bào)

ID:155507 發(fā)表于 2021-6-7 13:56 | 顯示全部樓層
MFRC522的Arduino函數(shù)
  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. }
復(fù)制代碼



MFRC522-1.4.8.zip

1.16 MB, 下載次數(shù): 18

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表