pySerial 2.6: specify end-of-line in readline()

后端 未结 5 594
独厮守ぢ
独厮守ぢ 2020-11-28 11:33

I am sending commands to Eddie using pySerial. I need to specify a carriage-return in my readline, but pySerial 2.6 got rid of it... Is there a workaround?

Here are

5条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 12:16

    It seems that the timeout occurs because readline() waits for an '\n' character to come from the serial device, which it never sends.

    According to the pyserial documentation, you can specify the end of line character:

    response = self.ser.readline(eol='\r')
    

    Does that work?

提交回复
热议问题