Commit 983813a1 authored by Felix Kettner's avatar Felix Kettner

pep8

parent cfc84f52
Pipeline #34300 passed with stage
in 22 seconds
......@@ -11,7 +11,8 @@ except ImportError:
from serial import Serial, SerialException
# From https://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
# From https://stackoverflow.com/questions/12090503/
# listing-available-com-ports-with-python
def get_serial_ports():
"""
Lists serial ports.
......@@ -38,7 +39,10 @@ def get_serial_ports():
return results
def open_serial_port(serial_port=None, baudrate=115200, timeout=None, write_timeout=0):
def open_serial_port(serial_port=None,
baudrate=115200,
timeout=None,
write_timeout=0):
"""
Try to open serial port with Arduino
If not port is specified, it will be automatically detected
......@@ -51,9 +55,12 @@ def open_serial_port(serial_port=None, baudrate=115200, timeout=None, write_time
# Open serial port (for communication with Arduino)
if serial_port is None:
serial_port = get_serial_ports()[0]
# timeout=0 non-blocking mode, return immediately in any case, returning zero or more,
# up to the requested number of bytes
return Serial(port=serial_port, baudrate=baudrate, timeout=timeout, writeTimeout=write_timeout)
# timeout=0 non-blocking mode, return immediately in any case,
# returning zero or more, up to the requested number of bytes
return Serial(port=serial_port,
baudrate=baudrate,
timeout=timeout,
writeTimeout=write_timeout)
def clamp(value, minimun, maximum):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment