views:

200

answers:

1

hi,

i want to send/receive data from my arduino board with a python script. I would like to do it using python and its pySerial module which seems to fit my needs. So i installed python and pySerial within cygwin (windows XP behind))

the python script is rather straight forward :

$ cat example.py

#print "testing my COM26 port using python"

import serial
ser = serial.Serial()
ser.baudrate = 9600
ser.port = 26
ser
ser.open()
ser.isOpen()

however at runtime i get the following error :

$ python example.py
Traceback (most recent call last):
  File "example.py", line 9, in <module>
    ser.open()
  File "/usr/lib/python2.5/site-packages/serial/serialposix.py", line 276, in open
    raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port 26: [Errno 2] No such file or directory: '/dev/com27'

could not open port 26: [Errno 2] No such file or directory: '/dev/com27'

How do i know my arduino is connected to port COM27 ? well it's simple, Arduino IDE says so, i can send and receive data from the Serial Port Monitor tool for the IDE using that port. Beside, I managed to get the hyperterminal working using that port too.

However, it seems cygwin is not aware of such USB & COM ports :

$ ls -lah /dev
total 4,0K
.
..
fd -> /proc/self/fd
mqueue
shm
stderr -> /proc/self/fd/2
stdin -> /proc/self/fd/0
stdout -> /proc/self/fd/1

it should be mentioned that i am running this on a dell laptop that has no classic serial COM port, just USB ports. (so i guess it's plain normal for instance that /dev/com1 does not exists)

dont know if i'm asking correctly but my question is : how can i configure cygwin so that it becomes aware of this com27 port ?

+1  A: 

If you are using laptop without port COM, you can't open this port and start make operations. In windows functions it is way to open this port and change state some line (RST), read states and make transmission. For LPT port you can't do it in Windows, have to use some library. For USB it is also problem, you must know device connected to USB.

Thomas