我正在尝试,但到目前为止,未能使用 python asyncio 访问串行端口。
我真的很感激关于在简单的 fd 上使用新的 python 异步框架的任何提示。
Cheers!
James
这是一个使用的工作示例pyserial异步 https://github.com/pyserial/pyserial-asyncio:
from asyncio import get_event_loop
from serial_asyncio import open_serial_connection
async def run():
reader, writer = await open_serial_connection(url='/dev/ttyS0', baudrate=115200)
while True:
line = await reader.readline()
print(str(line, 'utf-8'))
loop = get_event_loop()
loop.run_until_complete(run())
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)