I have to send ZANE:1:00004:XX_X.X_XXXX_000XX:\\r\\n
via serial communication with python.
here is my code:
import serial
ser = serial.Seria
I believe the earlier answers didn't understand that you are using the same port for writing and reading.
I'm having the same problem and solved it using a sleep function. Basically:
import serial
from time import sleep
ser = serial.Serial('/dev/cu.usbserial-A901HOQC', timeout=1)
ser.baudrate = 57600
msg = 'ZANE:1:00004:XX_X.X_XXXX_000XX:\r\n'
ser.write(msg)
sleep(0.5)
ser.readline()
So with that sleep you are giving time to the receiver (a machine?) to send the reply. Also note that you have to add a timeout if you want to use readline.