Friday, April 6, 2012

write/read to serial port

Well, when you have pyserial installed on your pc writing to serial port is fairly simple. here is the how you do it..

import serial
ser = serial.Serial(, ,timeout=1)
print ser.portstr
ser.write("hello" + "\n")

the above sample code best describes how to write or read from a serial port using python - pyserial library. This is not the best of the solutions available out there but def simple (probably the simplest :) ). you could do more digging into the serial library too if you would like.

Like I always say happy scripting !!!

No comments:

Post a Comment