# coding:utf-8import time,serial ser = serial.Serial(‘COM3‘, 57600, timeout=10,parity=serial.PARITY_EVEN, rtscts=1) i = 0now = time.time()print(ser.inWaiting())# while ser.inWaiting() > 0:while 1: s = ser.readline() i +=1 # nows = time.strftime(‘%Y-%m-%d %H:%M:%S‘, time.localtime(time.time())) nows = time.time() if nows > now + 60: break # data += ser.read(10)# if data != ‘‘:# print (data) print(s) print((i)/3)
时间: 2024-10-05 07:53:19