[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Beginner Pyserial Question

Tim Spens

1/24/2008 5:28:00 PM

COM = 0 #for COM1
BAUD = 115200

class serial_port():
def __init__(self):
self.start_time = None
self.end_time = None
self.asleep_duration = None

self.device = serial.Serial()
self.device.timeout = 1
self.device.baudrate = BAUD
self.device.port = COM

a_serial_port = serial_port()
a_serial_port.device.open()

----- Original Message ----
From: "JAMoore84@gmail.com" <JAMoore84@gmail.com>
To: python-list@python.org
Sent: Thursday, January 24, 2008 10:13:39 AM
Subject: Re: Beginner Pyserial Question



> My guess is that for whatever reason the 'first' serial port
> (which is what you're asking for by specifying a 0 when
> instantiating the Serial class) doesn't actually exist. Serial
> device names under Windows are broken.

I realize this. I tried connecting to different port "numbers", but I
have not tried the serial.Serial(COM1). I wasn't sure if that worked,
but I know a quick way to find out.


> Try using the actual name of the com port (e.g. 'COM3' or
> 'COM5') instead of 0.

The com port used in Hyper Terminal is COM40. I have tried connecting
to 39/40/41 to no avail.

> Oh, if you end up having to use a com port higher than COM9,
> that's broken in Windows as well, and you've got to sprinkle a
> bunch of backslashes into the device name (I don't remember the
> exact syntax).

That might become an issue when I try to read COM40 for the GPS
bluetooth transmission. This issue does not relate to why I cannot
open smaller com ports, though.

--
http://mail.python.org/mailman/listinfo/p...





____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yaho...