前言
指纹模块AS608
接线:tx GPIO13,rx GPIO12
代码
复制即用
from machine import UART
import time,struct,btree
class As608(object):
def __init__(self,uart):
self.finger_command = b'\xef\x01\xff\xff\xff\xff\01\x00\x03\x01\x00\x05'
self.clear_all_command = b'\xef\x01\xff\xff\xff\xff\01\x00\x03\x0d\x00\x11'
self.login_command = b'\xef\x01\xff\xff\xff\xff\01\x00\x03\x10\x00\x14'
self.search_command = b'\xef\x01\xff\xff\xff\xff\01\x00\x03\x11\x00\x15'
self.del_one_command=b'\xef\x01\xff\xff\xff\xff\01\x00\x07\x0c'
self.uart=uart
def del_numid(self,num): #删除指纹,输入指纹序号(正整数)
self.uart.read()
data = self.del_one_command+struct.pack('>h',num)+b'\x00\x01'
data_list = struct.unpack('%db'%len(data[6:]),data[6:])