设备已发送数据,数据为真,但程序仍等待5秒钟以打印结果
ser = serial.Serial(
port='COM2',
baudrate=115200,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS)
SenDdata = 'Python'
if ser.is_open:
ser.write(SenDdata)
ser.timeout = 5
RevData = ser.read_until(terminator = '55', size= None)
ser.close()