[EMAIL PROTECTED] wrote:
> Hiya,
> 
> I've got a PIC microcontroller reading me humidity data via rs232, this
> is in ASCII format. I can view this data easily using hyperterminal or
> pyserial and convert it to its value (relative humidty with ord(input))
> 
> But what im trying to do is plot the data in real time, ideally with
> pylab - as it looks simple to use and simple is the way i want to go!
> 
> My code is below, it doesnt show a graph, I was wondering whether
> someone could suggest whats wrong?

You have to call pylab.show() for the graph to be drawn. I don't know if it 
will work incrementally if you call show() in the loop.

Kent

> 
> thank you in advance
> 
> David
> 
> ########################################################################
> 
> import serial
> from pylab import *
> 
> ser = serial.Serial(0)
> t = arange(0.0, 1.0+0.01, 0.01)
> 
> xlabel('time')
> ylabel('RH %')
> title(' RH sensor data sampled at 1 sec intervals ')
> #grid(true)
> 
> x = 0
> 
> while 1:
>       s = ser.read()
>       b = ord(s)
>       h = []
>       h.append(b)
>       x = x + 1
>       plot(t,h)
> 
> ser.close
> 
> ########################################################################
> 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to