pySerial read comes empty. While using alternate tool, the COM read and write works well.
Before the Raspbian format, it worked well, but now for some reason, the read command returns nothing.
Code:
import serial
import time
ser = serial.Serial(port="/dev/ttyUSB0",
baudrate=115200,
timeout=10,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)
print("+ " + str(ser.write(("help\r\n").encode())))
print("+ " + str(ser.isOpen()))
res = ser.read(size=5) #.dencode()
print("+ " + str(res))
ser.close()
print("+ " + str(ser.isOpen()))
Output:
- 6
- True
- b''
- False
Expected:
- 6
- True
- some binary content
- False