import time import serial device = serial.Serial( port="COM11", baudrate =115200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1) def get_stop_bit() -> bytearray: stop_bit = bytearray() stop_bit.append(0xFF) stop_bit.append(0xFF) stop_bit.append(0XFF) return stop_bit def send_stop_bit(): device.write(get_stop_bit()) def reset_device(): send_command("rest") def send_command(command: str): command = bytes(command, 'ascii') device.write(command) send_stop_bit() def send_command(command: str): command = bytes(command, 'ascii') device.write(command) send_stop_bit() send_command("rest") time.sleep(1) send_command("page parent")