硬件型号
Esp32 DevKit v1
RFID-RC522
固件版本
MicroPython v1.9.4
Micropython-Mfrc522的安装
Github地址
对于这个项目,我们只需要适当地修改mfrc522.py
与read.py
并只上传这两个文件给esp32就可以了
修改mfrc522.py
的第32行
# 加入esp32的名字
elif board == 'esp8266' or board == 'esp32':
self.spi = SPI(baudrate=100000, polarity=0, phase=0, sck=self.sck, mosi=self.mosi, miso=self.miso)
self.spi.init()
read.py代码如下:1
import mfrc522
from os import uname
ESP32_HSPI_CLOCK = 14 #P14 (HSPICLK in ESP32 Docs)
ESP32_HSPI_SLAVE_SELECT = 15 #P15 (HSPICS0 in ESP32 Docs)
ESP32_HSPI_MISO = 12 #P12 (HSPIQ[uery] in ESP32 Docs)
ESP32_HSPI_MOSI = 13 #P13 (HSPID[ata] in ESP32 Docs)
ESP32_MFRC522_RST = 5 #SD3, as plain GPIO - can be any unused GPIO
def do_read():
if uname()[