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
|