I would like to send such array for example via pyserial:
[49, 56, 48] or [82]
I tried such solution before sending:
print(list(str(180).encode()))
And it gives me array as I want. But when I tried to send it via pySerial, it said that I need to have buffer instead of list. In general I'm trying to get some analogue from kotlin:
byteArrayOf('O'.code.toByte())
"70".toByteArray()
Which gives me such arrays for sending them to Arduino. I tried sending maps, dicts, and so on, but did not succeed. Whether it's possible to have something similar in Python? python sending code:
import json
import struct
import serial
ser = serial.Serial('/dev/tty.usbmodem14401', 9600)
data = [49, 56, 48]
ser.write(json.dumps(data) + '\n')
ser.write(str('R').encode())
ser.write(str(80).encode())
encode()returns a byte array, so just use.write(str(180).encode())