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. COM1, 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

_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to