Showing posts with label pyserial port usage. Show all posts
Showing posts with label pyserial port usage. Show all posts

Friday, March 14, 2014

Python libraries


Long time no c ... :)  I know.
lets get back to business.
I have had interesting issues with my python scripting . thought of sharing one of them.
I was asked to create a plot for application performance comparison across multiple platforms. this turned out to be a tricky one as I hardly worked on graphs.

To my surprise, i found an easy and interesting library for this.

matplotlib.pyplot

amazing tool. very user friendly. here is the link to the same with few examples.

http://matplotlib.org/index.html

happy scripting :)




Wednesday, December 28, 2011

pyserial port scan

if you are using pyserial module to read the communication from your device on UART , you will have to know which port the is your system connected to.

the following is a simple code to scan through all the COM ports and find out which com port is in opened. at the end of the program , you will see the serial uart that is in use being printed

import pyserial
for i in range(256):
try:
s = serial.Serial(i)
available.append( (i, s.portstr))
port = i
s.close()
except serial.SerialException:
pass

ser = serial.Serial(port, 115200,timeout=1)
print ser.portstr


happy scripting!