Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zmitchell/async-serial
Example code using asyncio, pyserial, and pyserial-asyncio
https://github.com/zmitchell/async-serial
asyncio pyserial python python3 serial
Last synced: 2 months ago
JSON representation
Example code using asyncio, pyserial, and pyserial-asyncio
- Host: GitHub
- URL: https://github.com/zmitchell/async-serial
- Owner: zmitchell
- License: apache-2.0
- Created: 2018-03-19T14:48:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-24T19:08:06.000Z (about 2 years ago)
- Last Synced: 2023-03-10T12:01:49.931Z (almost 2 years ago)
- Topics: asyncio, pyserial, python, python3, serial
- Language: Python
- Homepage:
- Size: 11.7 KB
- Stars: 46
- Watchers: 4
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Async Serial
This is example code showing you how to do asynchronous serial communication such as ASCII-over-serial, as is common in scientific settings. There is an accompanying article here:
* [Bringing async to serial devices][post]
## Usage
This code relies on the experimental [`pyserial-asyncio`][pyserial-asyncio] library, which at this time only supports Unix-based systems (Linux, macOS, etc). As explained in the article, you'll need the tool [`socat`][socat] to create virtual serial ports so that you don't need a real device to try out the code.
### Install the dependencies
Clone this repository:
```bash
git clone https://github.com/zmitchell/async-serial.git
```The dependencies are managed with [`pipenv`][pipenv], the new officially sanctioned packaging tool for Python. Install the dependencies via:
```bash
pipenv install
```This will create a virtual environment and install the dependencies listed in the [`Pipfile`](Pipfile) into it.
### Run the code
You run the code in the virtual environment created by `pipenv` via
```bash
pipenv run python3 async_serial_protocol.py
```To run one of the other programs, simply replace `async_serial_protocol.py` with the name of the program.
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.[post]: https://tinkering.xyz/async-serial/
[pyserial-asyncio]: http://pyserial-asyncio.readthedocs.io/en/latest/index.html
[socat]: http://www.dest-unreach.org/socat/
[pipenv]: https://github.com/pypa/pipenv