下面是实现代码
# coding:utf-8
import time, serial
from struct import *
import binascii
file = open('E:\\1.bin', 'rb')
i = 0
while 1:
c = file.read(1)
# 将字节转换成16进制;
ssss = str(binascii.b2a_hex(c))[2:-1]
print(str(binascii.b2a_hex(c))[2:-1])
if not c:
break
ser = serial.Serial('COM3', 57600,
1