欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Python3 串口接收與發(fā)送16進制數(shù)據(jù)包的實例

 更新時間:2019年06月12日 11:23:23   作者:colcloud  
今天小編就為大家分享一篇Python3 串口接收與發(fā)送16進制數(shù)據(jù)包的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

如下所示:

import serial
import string
import binascii
s=serial.Serial('com4',9600)
s.open()
#接收
n=s.inwaiting()
if n: 
  data= str(binascii.b2a_hex(s.read(n)))[2:-1]
  print(data)
#發(fā)送 
d=bytes.fromhex('10 11 12 34 3f') 
s.write(d)
s.close()

以上這篇Python3 串口接收與發(fā)送16進制數(shù)據(jù)包的實例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

最新評論