Pages: [1]   Go Down
Author Topic: Python -> serial -> Arduino  (Read 1122 times)
0 Members and 1 Guest are viewing this topic.
Bergen, Norway
Offline Offline
Newbie
*
Karma: 0
Posts: 37
Just4fun
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\serialwin32.py", line 30, in __init__
    SerialBase.__init__(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\serial\serialutil.py", line 260, in __init__
    self.open()
  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...?


Karl


Did i mention i started with python today? smiley
« Last Edit: January 17, 2011, 04:21:00 am by Wracul » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49037
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.
Logged

0
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)
Logged

Pages: [1]   Go Up
Jump to: