add python script
This commit is contained in:
11
serial_listener.py
Normal file
11
serial_listener.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# from https://stackoverflow.com/questions/26047544/python-serial-port-listener
|
||||||
|
import serial
|
||||||
|
import select
|
||||||
|
|
||||||
|
timeout = 10
|
||||||
|
conn = serial.Serial("/dev/ttyUSB0", 115200, timeout=0)
|
||||||
|
read,_,_ = select.select([conn], [], [], timeout)
|
||||||
|
while True:
|
||||||
|
read_data = conn.read(0x100)
|
||||||
|
if read_data:
|
||||||
|
print(read_data)
|
||||||
Reference in New Issue
Block a user