I am trying to send a string variable contains the command.
Like this:
value="[0x31, 0x0a, 0x32, 0x0a, 0x33, 0x0a]"
self.s.write(serial.to_bytes(value))
The above one fails. Won't give any error.
But it's working when I send a value like this:
self.s.write(serial.to_bytes([0x31, 0x0a, 0x32, 0x0a, 0x33, 0x0a]))
I also tried sending string like this:
self.s.write(serial.to_bytes(str(value)))
Still not working. Can someone please let me know how to send the value by storing in string?
I want to do this thing:
value="[0x"+anotherstring+",0x"+string2+"0x33, 0x0a]"
and send the value.
Thanks!