pyserial的异步包装器
asyncserial的Python项目详细描述
=========
pyserial的异步包装
======
=======图片::https://badge.fury.io/py/asyncSerial.svg
:目标:https://badge.fury.io/py/asyncSerial
:alt:pypi版本
…图片::https://img.shields.io/pypi/pyversions/asyncSerial.svg
:目标:https://pypi.org/project/asyncSerial/
:alt:python版本
…图片::https://readthedocs.org/projects/asyncSerial/badge/?version=latest
:目标:http://asyncSerial.readthedocs.io/en/latest/?badge=latest
:alt:documentation status
`asyncSerial`是“pySerial”库的包装,提供基于“async def”和“await”的异步接口。
代码块:sh
pip install asyncSerial
documentation
==
代码块::python
import asyncio
from asyncSerial import serial
loop=asyncio.get_event_loop()
test_serial=serial(loop,“/dev/ttyacm0”,波特率=115200)
async def test():
等待测试串行。read();删除已接收的任何内容
如果为true:
line=await test串行。readline();读取一行
打印(“[+]串行读取:{}”。格式(行))
等待asyncio.sleep(0);让我们有点贪婪,应该调整满足您的需要
pyserial的异步包装
======
=======图片::https://badge.fury.io/py/asyncSerial.svg
:目标:https://badge.fury.io/py/asyncSerial
:alt:pypi版本
…图片::https://img.shields.io/pypi/pyversions/asyncSerial.svg
:目标:https://pypi.org/project/asyncSerial/
:alt:python版本
…图片::https://readthedocs.org/projects/asyncSerial/badge/?version=latest
:目标:http://asyncSerial.readthedocs.io/en/latest/?badge=latest
:alt:documentation status
`asyncSerial`是“pySerial”库的包装,提供基于“async def”和“await”的异步接口。
代码块:sh
pip install asyncSerial
documentation
==
代码块::python
import asyncio
from asyncSerial import serial
loop=asyncio.get_event_loop()
test_serial=serial(loop,“/dev/ttyacm0”,波特率=115200)
async def test():
等待测试串行。read();删除已接收的任何内容
如果为true:
line=await test串行。readline();读取一行
打印(“[+]串行读取:{}”。格式(行))
等待asyncio.sleep(0);让我们有点贪婪,应该调整满足您的需要