Pyserial从未读过 [英] Pyserial never read
本文介绍了Pyserial从未读过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
对不起我的英语,但我是意大利语。
我使用pyserial通过rs232与一个叫做
$的套用设备进行通信b $ b smartmouse。
我写了我想要的确切行,但是当我读到的时候我只读了
echo而不是其他字节。
当我使用delphi使用相同的项目时,我使用
调用睡眠来解决这个问题。
但是在python中它不起作用。 />
你有什么想法可以解决我的问题吗?
最好的问候
Luca
>
推荐答案
我不太了解python但我可以用英语帮助你吗?
尽管它真的很好
最好的问候 -
只是
I don''t know alot about python but I could help you with english?
eventhough it was really good
best regards-
Just
谢谢
Luca
Thanks
Luca
你好,
我不确定我是否理解你的问题但是也许你可以 尝试
a readline和类似的flushinput:
导入序列号
port = 0#或端口在哪里你的设备是连接的
baudrate = 9600#或设备的波特率
s = serial.Serial(port,baudrate)#打开端口
for i in range(100):
s.flushInput()
line = s.readline()
打印行
Hello,
I''m not sure I understand precisely your question but maybe you can try
a readline and a flushinput like that:
import serial
port= 0 # or the port where you''re device is connected
baudrate=9600 # or the baudrate of your device
s = serial.Serial(port, baudrate) # Open the port
for i in range(100):
s.flushInput()
line= s.readline()
print line
这篇关于Pyserial从未读过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文