Python 3.10 ругает так:
“
TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: ‘33985056090909112100006e’
”
import serial ser = serial.Serial (port='COM1',baudrate=9600, parity=serial. PARITY_NONE, stopbits=serial. STOPBITS_ONE, bytesize=serial.EIGHTBITS,timeout=0) dtr_string1 ="33 98 50 56 09 09 09 11 21 00 00 6e" print(dtr_string1) s_string1 = dtr_string1.replace(" ", "") print(s_string1) ser.write(s_string1) print(s_string1) ser.close
