[Python-au] hi all
Garth Kidd
garth@deadlybloodyserious.com
Wed, 22 Jan 2003 16:41:19 +1100
> can some one show me a complete script which allows me to communicate
> with the windows serial port.
Looks pretty basic. http://pyserial.sourceforge.net/ gives examples.
> id like to open the port2 and read some incoming text strings.
I had a shot:
ActivePython 2.2.2 Build 224 (ActiveState Corp.) based on
Python 2.2.2 (#37, Nov 26 2002, 10:24:37) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> ser = serial.Serial(2, 19200, timeout=1)
>>> print ser.portstr
COM3
>>> ser.write('at\r')
>>> ser.readline()
'at\r\r\n'
>>> ser.readline()
'OK\r\n'
Now, that's not exactly a "complete script", but the module appears to
work just fine. What're you running into?
Regards,
Garth.