1

I'm trying to connect to my Ardiuno with Python on my Ubuntu computer. I tried this example: http://playground.arduino.cc/interfacing/python

But I always get:

>>> import serial
>>> ser = serial.Serial('/dev/tty.usbserial', 9600)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-x86_64/egg/serial/serialutil.py", line 282, in __init__
  File "build/bdist.linux-x86_64/egg/serial/serialposix.py", line 289, in open
OSError: [Errno 2] No such file or directory: '/dev/tty.usbserial'
>>> 

I can use the serial connection in sketch without any problems. I also added my user to the groups tty and dialout.

How do I connect to my Arduino using Python?

1 Answer 1

1

list the serial ports first. I'm not sure dev/tty.usbserial is correct.

You try do ls /dev/tty* in Terminal, pehaps your Arduino board will pop up as ttyACM0 or something like that(sorry, haven't used Ubuntu in a while).

You can also check out the PySerial finding ports article(may need PySerial 2.7 or newer)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.