how to write CR/LF line ending into serialport with C or Python?
newline, pyserial, python, serial-port
Solution
If you have `timeout=0` and do a `readline()` immediately after sending, the answer is probably not yet received.
Better try `timeout=.5` and adjust the value according to your observations.
In this case, it might as well be that the balance doesn't write correct "lines". In these cases try `bal.read(100)`. The timeout will stop as soon as no further characters are coming.
Problem
I used python and C to communicate with my balance, but I can't write CR/LF line ending into it. why? ``` import serial bal = serial.Serial("/dev/ttyUSB0",9600,timeout=0) bal.write('P\r\n') print bal.readline() ``` I can get values through cutecom, but why can't I get values through this code? I am using Linux, why doesn't the program recognize the line ending?