Python Forum
Lib PySerial - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Lib PySerial (/thread-28140.html)



Lib PySerial - Pelathaon - Jul-07-2020

Hello.

I'm using library PySerial and connectiong to the coverter RS485 with socket. (__https://pyserial.readthedocs.io/en/latest/url_handlers.html#socket)

Question: How i can manage baud rate, timeouts in socket type connection?


RE: Lib PySerial - Larz60+ - Jul-07-2020

did you look at the documentation?
There are clear examples there, see: https://pythonhosted.org/pyserial/shortintro.html#opening-serial-ports
as fas as timeouts: https://pythonhosted.org/pyserial/pyserial_api.html?highlight=timeout#serial.Serial.timeout


RE: Lib PySerial - DashOrion - Jul-07-2020

All is in the documentation. But for now, here you have a small example:

ser = serial.Serial()
ser.baudrate = 100000
ser.port = port
ser.parity = serial.PARITY_EVEN
ser.stopbits = 2
ser.open()