pyserial script doesnt execute properly
Andy
fukazawa at gmail.com
Wed Mar 10 00:01:48 EST 2010
Hi Kishore,
Have you tried "ser=serial.Serial(port='COM2', baudrate=9600)" instead
of "port='\\.\COM2'"?
Also, I'd suggest you temporarily define some other parameters that
now you're leaving to default values. From the documentation of
pyserial:
readline(size=None, eol='\n')
You're sure that your Arduino device is sending a '\n' right after the
'1', aren't you? Or is it two consecutive '1'?
And another idea: If this is your first experience with PySerial, I
suggest you first use some free software as counterpart to your
Arduino device in order to confirm the microcontroller is sending
exactly what you think it is sending. In other words, is it sending
to your Python program '11' or '1\n1\n'? Also to confirm other
details such as parity bits, baud, etc.
Cheers,
Andy
More information about the Python-list
mailing list