Python_serial.py:
Code: Select all
import serial
ser = serial.Serial('/dev/tty.usbserial', serial.EIGHTBITS, serial.PARITY_NONE, serial.STOPBITS_ONE)
# 6 byte at a time
ser.write(b'\xA0h\xC1h\x01\x00h\x00h\xAFh')
# 1 byte at a time
for command in [b'0xA0h', b'0xC1h', b'0x01', b'0x00h', b'0x00h', b'0xAFh']:
ser.write(command)
ser.close()