UIFlow Guide
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit
setScreenColor(0x222222)
finger_0 = unit.get(unit.FINGER, unit.PORTE)
label1 = M5TextBox(23, 69, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
title0 = M5Title(title="FINGERPRINT", x=3, fgcolor=0xFFFFFF, bgcolor=0x0000FF)
def finger_0_cb(user_id, access):
# global params
if (access) == 1 and (user_id) == 1:
rgb.setColorAll(0x33ff33)
wait(1)
rgb.setColorAll(0x000000)
pass
finger_0.readFingerCb(callback=finger_0_cb)
def buttonA_wasPressed():
# global params
finger_0.removeAllUser()
pass
btnA.wasPressed(buttonA_wasPressed)
def buttonB_wasPressed():
# global params
finger_0.addUser(1, 1)
pass
btnB.wasPressed(buttonB_wasPressed)
while True:
label1.setText(str(finger_0.state))
wait_ms(2)
finger_0.uart_port_id(1)
finger_0.addUser(1, 1)
def finger_0_unknownCb():
# global params
pass
finger_0.getUnknownCb(finger_0_unknownCb)
print(access)
print(user_id)
print(finger_0.state)
def finger_0_cb(user_id, access):
# global params
pass
finger_0.readFingerCb(callback=finger_0_cb)
finger_0.removeAllUser()
移出指纹ID