Skip to content

Instantly share code, notes, and snippets.

@thisMagpie
Last active February 12, 2016 17:05
Show Gist options
  • Save thisMagpie/ebac0df74ce827d66125 to your computer and use it in GitHub Desktop.
Save thisMagpie/ebac0df74ce827d66125 to your computer and use it in GitHub Desktop.
from webiopi.devices.sensor import DS18S20
import datetime
import pylab
tmp0 = DS18S20(slave="10-000802de0ee7") # sensor found with "ls /sys/bus/w1/devices/"
time = [datetime.datetime.now()]
temp = [tmp0.getCelsius()]
pylab.ion()
pylab.xlabel('Time h:m:s')
pylab.ylabel('Temperature C')
pylab.title('Temperature vs Time')
pylab.ylim(temp[0] - 5.,temp[0] + 5.0)
while True:
time.append(datetime.datetime.now())
temp.append(tmp0.getCelsius())
pylab.plot(time, temp)
pylab.draw()
pylab.clf()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment