Skip to content

Instantly share code, notes, and snippets.

@crosstyan
Created November 15, 2023 04:28
Show Gist options
  • Save crosstyan/22610df4676160066c085e9d84394314 to your computer and use it in GitHub Desktop.
Save crosstyan/22610df4676160066c085e9d84394314 to your computer and use it in GitHub Desktop.
import serial
with serial.Serial("/dev/ttyUSB0", 9600, timeout=0.05) as ser:
buf = [0xc0, 0x00, 0x08,
0x03, 0xea, 0x84, 0x00, 0x0f, 0x03, 0x00, 0x00]
ser.write(bytes(buf))
r = ser.read(11)
print(r)
buf = [0xc1, 0x00, 0x08]
ser.write(bytes(buf))
r = ser.read(11)
print(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment