Skip to content

RuXBee/async-serial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-serial

async-serial is a asynchronous model of Serial object.

Installation

This is a version for use free in your project. Should install dependencies.

  1. Create a virtualenv with python
python -m venv .env
  1. INstall requirements
pip install -r requirements.txt

Usage

from async_serial import AsyncSerial

# Define callback for processing data
async def callback_when_data_incoming(data: bytes):
    print("[ESP32 DATA]",data.decode())



serial = AsyncSerial(pdescription="CP21", baudrate=9600)
serial.callback_incoming_plot = callback_when_data_incoming
# List available ports and get full manufacture data
serial.list_available_ports()

# Define asynchronous main
async def main():
    
    await serial.handle_serial("\n")


if __name__ == "__main__":
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        pass
    finally:
        print("[STOP] Program finish")
        pass

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages