I am so sorry for asking similar questions. But I managed to get some stuff yet I cannot make it work properly.
import serial
ser = serial.Serial(port='COM3', baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, timeout=1)
try:
ser.isOpen()
print("Serial port is open")
except:
print("ERROR")
exit()
if (ser.isOpen()):
try:
while (True):
ser.write("S CR LF")
print(ser.read())
except:
print("error")
else:
print("Cannot open serial port")
I learned that I should send some commands in order to receive information. https://i.stack.imgur.com/mPhcQ.jpg https://i.stack.imgur.com/fvJPo.jpg https://i.stack.imgur.com/a8lE8.jpg These are the Commands that I should use and then parse them in order to get the result only. This is what I get when I run this code. (I know, I should change the "ser.Write(this part)" but I don't know how?)
Serial port is open
error
Process finished with exit code 0