srne-mqtt/misc/test_serial_loopback.py

8 lines
201 B
Python
Raw Permalink Normal View History

2023-04-07 19:13:32 +00:00
# -*- coding: utf-8 -*-
2023-12-08 12:45:05 +00:00
from serial import Serial # type: ignore
2023-04-07 19:13:32 +00:00
with Serial("/dev/ttyUSB0", baudrate=9600, timeout=2) as x:
x.write(b"Hello, World!")
print(x.read(13))
print(x.read(13))