I have googled, read, experimented etc and still have had no luck sending a packet of 5 hex values over serial. Here is what I have tried:
import serial
import time
ser = serial.Serial(
port='dev/serial0''
baudrate=9600'
parity=serial.PARITY_NONE'
stopbits=serial.STOPBITS_ONE'
bytesize=serial.EIGHTBITS,
timeout=1
)
#tried this
cw = b'0x55,0x18,0x03,0x06,0x01'
ser.write(serial.to_bytes(cw))
#tried this
cw = b'\x55\x18\x03\x06\x01'
ser.write(serial.to_bytes(cw)
the name of the file is serialtest.py
I've tried:
python serialtest.py
i've tried python 3:
python3 serialtest.py
it either prints out on minicom: jibberish or actually
0x55,0x18,0x03,0x06,0x01
but I am not actually convinced this is actually hex data or just a string conversion of what is being sent. I can send the same hex packet from my windows box and the machine it is connected to does accordingly. Any help, ideas, examples, anything would be appreciated. I've wasted at least a week and a half on this.