ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-win32
python-win32
Re: [python-win32] COM ports connecting
by Ray Schumacher other posts by this author
Feb 21 2006 12:34PM messages near this date
Re: [python-win32] COM ports connecting | [python-win32] Fresh excel session
At 10:51 AM 2/21/2006, Math wrote:

> Hello,
>  
> Anybody could give me an example code of how connect/comunicate through COM ports (i.e. COM
1, COM2). 
> I'm under windows XP

I'm working on a command module for telescopes over COM ports,
http://rjs.org/Python/LX200.zip
so look at LXSerial.py and the  connect_port() method, as well as others there.

Ray


try:
    connectedPort = serial.Serial(
        port=port,              #number of device, numbering starts at
                                #zero. if everything fails, the user
                                #can specify a device string, note
                                #that this isn't portable anymore
                                #if no port is specified an unconfigured
                                #an closed serial port object is created
        baudrate=baud,          #baudrate
        bytesize=serial.EIGHTBITS,     #number of databits
        parity=serial.PARITY_NONE,     #enable parity checking
        stopbits=serial.STOPBITS_ONE,  #number of stopbits
        timeout=ptimeout,       #set a timeout value, None for waiting forever
        xonxoff=0,              #no software flow control
        rtscts=0,               #no RTS/CTS flow control
        writeTimeout=3,         #set a timeout for writes
        dsrdtr=None,            #None: use rtscts setting, dsrdtr override if true or false
    )
except serial.SerialException, s:
    raise 
Attachments:
unknown1
unknown2
unknown3
unknown4

Thread:
Math
John Machin
Math
Roel Schroeven
Ray Schumacher

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved