I’ve been trying to communicate with a piece of machinery.
I verified the COM port and baud rate and 8N1 setup and open port, etc. using manual CMD.
The manual indicates to use for start byte and
/
for end byte of telegram.
When I run it basically just hangs up, not sure what I’m doing wrong.
import serial char
ser = serial.Serial('COM6' , 115200)
ser.is_open
ser.write(b'p/')
s = ser.read(9)
print(s)
3
Answers
Amazingly helpful = Saiprasad Balasubramanian + Mike67 + Bukzor + SuzukiBKing I was successful with your advice. I plan to add the conditional later, thx SB ;).
You could try it out this way. I don’t have a device to verify it
From the manual it shows the returned codes for the "p" command as one or two characters. If you are trying to read 9 bytes with no timeout set it will hang until 9 bytes are received. Try using ser.read_all() after a short delay.