Add a fingerprint user with a specified user ID and access level, then continuously print the user's access level, ID, and status in a loop, and finally remove the user's information.
from m5stack import *
from m5ui import *
from uiflow import *
import face
setScreenColor(0x222222)
faces_finger = face.get(face.FINGER)
faces_finger.addUser(1, 1)
whileTrue:
print((str('access: ') + str((access))))
print((str('id: ') + str((user_id))))
print((str('state: ') + str((faces_finger.state))))
faces_finger.removeUser(1)
wait_ms(2)
API
faces_finger.addUser(1, 1)
Adds a user fingerprint with a specified user ID and access level.
deffaces_finger_unknownCb():# global paramspass
faces_finger.getUnknownCb(faces_finger_unknownCb)
Retrieves information about unregistered fingerprints, typically used to detect if there are any new fingerprints that haven't been recognized.
access
Retrieves the access level of the current fingerprint.
user_id
Retrieves the user ID of the current fingerprint.
faces_finger.state
Retrieves the status information of the current fingerprint.
deffaces_finger_cb(user_id, access):# global paramspass
faces_finger.readFingerCb(callback=faces_finger_cb)
Reads user information with a specific user ID and access level.
faces_finger.removeAllUser()
Removes all stored fingerprint user information. This operation will clear all registered user data.
faces_finger.removeUser(1)
Removes the fingerprint user information with the specified ID. By entering the user ID, you can delete the corresponding fingerprint user data.