一分钟内有300个产品从生产带中流出。使用光学测微器,使用pyserial和qthread,我尝试每秒接收200个。但是我不能像我预期的那样做对。当我保持固定时没有问题,但当对象移动时,我无法获得正确的结果。我需要检测与串口快速流动的项目的宽度。你如何推荐一种方法来解决这个问题?
发布于 2017-04-21 23:12:01
Question:。当我减少超时时,它偶尔会在数据流中中断。
尝试以下操作,减少到9600:。
Open port at “38400,8,E,1”, non blocking HW handshaking:
>>> ser = serial.Serial('COM3', 38400, timeout=0,
... parity=serial.PARITY_EVEN, rtscts=1)
>>> s = ser.read(100) # read up to one hundred bytes
... # or as much is in the bufferhttps://stackoverflow.com/questions/43529511
复制相似问题