srne-mqtt/misc/test_serial_loopback.py

8 lines
185 B
Python
Raw Normal View History

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