Answer the question
In order to leave comments, you need to log in
Pyserial on ubuntu + arduino?
There is a python code that just reads data from the com port, the code works on windows but does not work on ubuntu
Error:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 323, in _reconfigure_port
orig_attr = termios.tcgetattr(self.fd)
termios.error: (5, 'Input/output error')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 5, in <module>
ser = serial.Serial(port='/dev/ttyS5', baudrate=9600)
File "/usr/local/lib/python3.8/dist-packages/serial/serialutil.py", line 240, in __init__
self.open()
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 272, in open
self._reconfigure_port(force_update=True)
File "/usr/local/lib/python3.8/dist-packages/serial/serialposix.py", line 326, in _reconfigure_port
raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error')
import time
import serial
import datetime
ser = serial.Serial(port='/dev/ttyS5', baudrate=9600)
received = []
ser.write(b'begin\n')
time.sleep(5)
ser.write(b'hello')
line = ser.readline()
print(line.decode())
Answer the question
In order to leave comments, you need to log in
The instructions for installing the Arduino IDE on Linux say that you need to add your user to the dialout group so that you can interact with the port. Try it.
code works on windows but not on ubuntu
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question