查看ESP32 RFID的源代码
←
ESP32 RFID
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Overview == [[文件:Quantum-rfid.jpg | 600px]] <br><br> == Connections == [[文件:Quantum-rfid-connect.png | 600px]] <pre> RC522_SDA ---> Noduino_Quantum_D10 RC522_SCK ---> Noduino_Quantum_D13 RC522_MOSI ---> Noduino_Quantum_D11 RC522_MISO --->Noduino_ Quantum_D12 RC522_GND ---> Noduino_Quantum_GND RC522_RST ---> Noduino_Quantum_D9 RC522_3.3V ---> Noduino_Quantum_3V3 </pre> <br><br> == Quick start == === Install Python === * Install python 2.7 from https://www.python.org/ftp/python/2.7/python-2.7.msi The installation direcory is: C:\Python27 * Run the git for windows, add this line 'export PATH=/c/python27/:$PATH' into /etc/bash.bashrc * Enter 'Control Panel' ---> All Control Panel Items ---> System ---> Advanced System Settings (System Properties) ---> Advanced ---> Environment Variables, add the python into PATH: [[文件:Windows-path.jpg | 400px]] <br><br> === Install Git === Install Git for windows from: https://git-for-windows.github.io <br><br> === Install Arduino === * Install Arduino IDE * Run the git for windows, go to Arduino IDE installation directory: <source lang=bash> $ cd /PATH/TO/Arduino $ cd hardware $ mkdir espressif $ cd espressif $ git clone git://github.com/espressif/arduino-esp32.git esp32 $ cd esp32/tools $ python get.py # waitting for generating the toolchain $ $ cd ../../../../libraries $ git clone git://github.com/miguelbalboa/rfid.git Cloning into 'rfid'... remote: Counting objects: 1105, done. remote: Total 1105 (delta 0), reused 0 (delta 0), pack-reused 1105eceiving objects: K100% Receiving objects: 100% (1105/1105), 1.35 MiB | 459.00 KiB/s, done. Resolving deltas: 100% (582/582), done. Checking connectivity... done. </source> * Restart Arduino IDE <br><br> === 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> == Reference == ;;For more information please refer to: * [[Noduino]] * [[Noduino Quantum]] <br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br><br><br><br>
返回到
ESP32 RFID
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面