Beginner Pyserial Question

Tim Spens t_spens at yahoo.com
Thu Jan 24 12:28:09 EST 2008


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 at gmail.com" <JAMoore84 at gmail.com>
To: python-list at 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/python-list





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs




More information about the Python-list mailing list