pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Finger Unit

Example

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)

API

finger_0.uart_port_id(1)
  • Set the core component ID
finger_0.addUser(1, 1)
  • Add ID and access rights
def finger_0_unknownCb():
  # global params
  pass
finger_0.getUnknownCb(finger_0_unknownCb)
  • Unknown id and permission Perform the following operations
print(access)
  • Return access rights
print(user_id)
  • Return ID
print(finger_0.state)
  • Read the sensor status
def finger_0_cb(user_id, access):
  # global params
  pass
finger_0.readFingerCb(callback=finger_0_cb)
  • Add ID and access permission
finger_0.removeAllUser()
  • Remove all fingerprint information
移出指纹ID
  • Remove the fingerprint ID
On This Page