Pages: [1]   Go Down
Author Topic: Python -> serial -> Arduino  (Read 1181 times)
0 Members and 1 Guest are viewing this topic.
Bergen, Norway
Offline Offline
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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\", line 30, in __init__
    SerialBase.__init__(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\serial\", line 260, in __init__
  File "C:\Python27\lib\site-packages\serial\", 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? smiley
« Last Edit: January 17, 2011, 04:21:00 am by Wracul » Logged

Seattle, WA USA
Offline Offline
Brattain Member
Karma: 654
Posts: 50931
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Offline Offline
Sr. Member
Karma: 4
Posts: 310
Posts: 40382
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use linux, my python looks like this:

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

Pages: [1]   Go Up
Jump to: