srne-mqtt/misc/test_serial_loopback.py

8 lines
201 B
Python

# -*- coding: utf-8 -*-
from serial import Serial # type: ignore
with Serial("/dev/ttyUSB0", baudrate=9600, timeout=2) as x:
x.write(b"Hello, World!")
print(x.read(13))
print(x.read(13))