Files
macropados-client/TestWritingToDevice.py
Lucas Oskorep b5257f84a6 Initial commit
2022-06-07 19:18:54 -04:00

30 lines
694 B
Python

from serial import Serial
import serial.tools.list_ports as port_list
ports = list(port_list.comports())
#Windows code for figuring out which port to grab
for port in ports:
if "DF60BCA" in port.hwid and port.pid == 33032:
print("FOUND MACROPAD!")
ser = Serial(port.name)
ser.write(b"hello!\n")
line = ser.readline()
print(line)
print(line.decode("utf-8"))
line = ser.readline()
print(line)
print(line.decode("utf-8"))
line = ser.readline()
print(line)
print(line.decode("utf-8"))
line = ser.readline()
print(line)
print(line.decode("utf-8"))
ser.close()