pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Face Rfid

Example

Detect if an RFID card is nearby, read the card's UID and a string from a specified address, and write the string "rfid" to address 1 of the card.
from m5stack import *
from m5ui import *
from uiflow import *
import face

setScreenColor(0x222222)

faces_rfid = face.get(face.RFID)

while True:
  print((str('status: ') + str((faces_rfid.isCardOn()))))
  print((str('read card: ') + str((faces_rfid.readBlockStr((faces_rfid.isCardOn()))))))
  print((str('uid: ') + str((faces_rfid.readUid()))))
  faces_rfid.writeBlock(1, 'rfid')
  wait_ms(2)

API

faces_rfid.isCardOn()
  • Checks if an RFID card is near the reader. If a card is detected, the system will trigger the corresponding action.
faces_rfid.readBlockStr(faces_rfid.isCardOn())
  • Reads the string information stored at a specific address on the RFID card. The address is a location within the RFID card's memory.
faces_rfid.readUid()
  • Retrieves the UID of the currently scanned RFID card. This UID is unique and can be used to uniquely identify a card.
faces_rfid.writeBlock(1, 'rfid')
  • Writes the specified string data to a specific storage address on the RFID card. The data written can be any text information.
On This Page