pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Unit RFID

案例程序

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
rfid_0 = unit.get(unit.RFID, unit.PORTA)

while True:
  print(rfid_0.isCardOn())
  if rfid_0.isCardOn():
    print(rfid_0.readUid())
  wait_ms(2)

功能说明

print(rfid_0.isCardOn())
  • RFID卡片靠近返回1
print(rfid_0.readBlockStr(1))
  • 从地址读取数据
print(rfid_0.readUid())
  • 返回RFID卡片的UID
rfid_0.writeBlock(1,'M5Stack')
  • 向地址写入数据
On This Page