[python-win32] Problem with Pyserial
J.D. Main
jdmain at comcast.net
Tue Jun 15 03:02:31 CEST 2010
Hello,
Question: How do you know that ser.write("hello\n") isn't outputing the string
"hello"? Did you plug another computer into that COM port to check?
I have learned to never take any serial port stuff for granted. I usually plug
another computer into the serial port to make absolutely sure that data is
really flowing at the baudrate that I expect.
PC1(with python script)
|
*
null modem DB9F-DB9F cable
*
|
PC2 (with hyperterminal listening at 9600 baud)
If you run the python script, and your port is really setup correctly, you will
see the string "hello" on the other end. If you don't, it is possible that COM1
ser(0) isn't the port on the back your PC - maybe it's COM2 or COM3 or
COM23...
Also, be sure that you've got the right cable - Straight Thru vs Null Modem.
If you're trying to connect a Female port to a Male port, then you need a
straight thru cable (probably). If you're trying to connect a M to M or F to F
then you need a null modem (probably).
I have used Pyserial a lot and it always does what I want so my guess is that
you are using the wrong cable, sending the wrong string, or instantiating the
wrong serial port. Of course, it is possible that your serial port is busted - it
can happen (that sucks!) Good luck.
JDM
Hello,
I am trying to send some information out of my computer's serial port. I
found the code posted below online, and the person who posted it said it
worked for them. However, when I tried the code, nothing was sent through
the serial port but I didn't receive any error messages. Does anyone know
what the problem could be?
import serial
ser=serial.Serial(0)
ser.baudrate=9600
ser.port=0
ser.open()
ser.write("hello\n")
ser.close()
Thanks,
Dan
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
More information about the python-win32
mailing list