海凌科指纹模块python读取代码ML-383F,ML-583F

海凌科的  海凌科HLK-FPM383F FPM583F都是深圳魔力信息给供货的,在淘宝等网站花20元左右就能买到指纹模块了,用于指纹锁等应用场景性价比还是很高的。

python读取和检测代码如下:


import serial
from time import sleep

ser = serial.Serial("COM35",57600,timeout=0.5)
# print (ser.portstr)

while 1:

    ser.write(bytes.fromhex("f1 1f e2 2e b6 6b a8 8a 00 07 86 00 00 00 00 01 22 dd"))
    teststr=""
    for i in range(0,10):
        sleep(0.1)
        n = ser.inWaiting()#获取接收到的数据长度
        print(n)
        if n:
            teststr=teststr+ser.read(n).hex()
        if len(teststr)>=8:
            break
    if i>=14 :
        print( "cmd return timeout!")
    print(teststr,teststr[-4:-2],teststr[-10:-6])
    print("FP ID:",teststr[-4:-2]," 准确率:",int("0x"+teststr[-10:-6],16))
    sleep(0.1)
    
    ser.write(bytes.fromhex("f1 1f e2 2e b6 6b a8 8a 00 07 86 00 00 00 00 01 21 de"))
    teststr=""
    for i in range(0,10):
        sleep(0.1)
        n = ser.inWaiting()#获取接收到的数据长度
        if n:
            teststr=teststr+ser.read(n).hex()
        if len(teststr)>=8:
            break
    if i>=14 :
        print( "cmd return timeout!")
    # print(teststr)

    sleep(1)

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值