Dear All,
I am new to python. I need to write ctrl-z to a serial port to signal the end of input. This is required by the message format. I use:
-
ser = serial.Serial(port=COMPORT,baudrate=BAUDRATE,bytesize=8,parity='N',stopbits=1,timeout=3,xonxoff=0,rtscts=0,)
-
ser.open()
-
ser.write("testing\x1A")
But the ctrl-z (ascii 26) doesn't seem to be written to the serial port. The firmware still waiting for message input because it can't see the ctrl-z. Is there something special in python to handle ctrl-z?
Thank you for your help!
Since you have the ascii code in Python correctly represented, I must ask:
So, can you confirm that the characters preceding the ctrl-z actually arrive?
Can you cause characters to be sent
from the device (with (say) a reset), which you could then try to ser.read()?
On your platform (which is info that you should give) is COMPORT defined well enough to actually point to a com port device?