查看ESP32 RFID的源代码
←
ESP32 RFID
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
=== Compile and Upload === * Run Arduino IDE, click File --> New, input following code in the new windows in Arduino IDE: <source lang=cpp> #include <SPI.h> #include <MFRC522.h> #define RST_PIN SCL // Configurable, see typical pin layout above #define NR_OF_READERS 1 byte ssPins[] = {SS}; MFRC522 mfrc522[NR_OF_READERS]; // Create MFRC522 instance. void setup() { Serial.begin(115200); // Initialize serial communications with the PC while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4) SPI.begin(); // Init SPI bus for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) { mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card Serial.print(F("Reader ")); Serial.print(reader); Serial.print(F(": ")); mfrc522[reader].PCD_DumpVersionToSerial(); } } void loop() { for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) { // Look for new cards if (mfrc522[reader].PICC_IsNewCardPresent() && mfrc522[reader].PICC_ReadCardSerial()) { Serial.print(F("Reader ")); Serial.print(reader); // Show some details of the PICC (that is: the tag/card) Serial.print(F(": Card UID:")); dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size); Serial.println(); Serial.print(F("PICC type: ")); MFRC522::PICC_Type piccType = mfrc522[reader].PICC_GetType(mfrc522[reader].uid.sak); Serial.println(mfrc522[reader].PICC_GetTypeName(piccType)); // Halt PICC mfrc522[reader].PICC_HaltA(); // Stop encryption on PCD mfrc522[reader].PCD_StopCrypto1(); } //if (mfrc522[reader].PICC_IsNewC } //for(uint8_t reader } void dump_byte_array(byte *buffer, byte bufferSize) { for (byte i = 0; i < bufferSize; i++) { Serial.print(buffer[i] < 0x10 ? " 0" : " "); Serial.print(buffer[i], HEX); } } </source> Select: [[文件:Quantum-rfid-arduino.jpg | 700px]] Press Ctrl + U to upload the firmware into Quantum board Open the serial with 115200 bitrate, reset the board, use a rfid card to touch the rc522: [[文件:Quantum-rfid-uart.jpg | 600px]] <br><br>
返回到
ESP32 RFID
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面