10 lines
254 B
Python
10 lines
254 B
Python
import serial
|
|
import time
|
|
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=115200)
|
|
ser.write(b'HX\x02\x02\x00')
|
|
time.sleep(1)
|
|
ser.write(b'HX\x02\x02\x01')
|
|
print(f"Listening for messages on {ser.name}:")
|
|
while True:
|
|
print(ser.readline())
|
|
ser.close()
|