Go Down

Topic: Python -> serial -> Arduino (Read 1 time) previous topic - next topic


Jan 17, 2011, 01:38 am Last Edit: Jan 17, 2011, 10:21 am by Wracul Reason: 1
First:   Im a NOOB.
Second: cant connect python to my com3(usb) where my arduino mega is located.

pyserial 32bit and python 32bit, running on win7 64bit.

Here is the python code and result.

>>>ser = serial.Serial('COMM3', 9600)
ser.write('hello world')

Traceback (most recent call last):
 File "<pyshell#16>", line 1, in <module>
   ser = serial.Serial('COMM3', 9600)
 File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 30, in __init__
   SerialBase.__init__(self, *args, **kwargs)
 File "C:\Python27\lib\site-packages\serial\serialutil.py", line 260, in __init__
 File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 56, in open
   raise SerialException("could not open port %s: %s" % (self.portstr, ctypes.WinError()))
SerialException: could not open port COMM3: [Error 2] Systemet finner ikke angitt fil.
(Norwegian: cant find file)

Am i missing something in the python program or...?


Did i mention i started with python today? :)


Com port names, on Windows, are COMn, where n is 1 to 9. The format changes slightly when n exceeds 9. You have two Ms in the name, not one.

Big Oil

I use linux, my python looks like this:

ser = serial.Serial('/dev/ttyUSB0', 9600)

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131