Skip to content

Instantly share code, notes, and snippets.

@thisMagpie
Created February 11, 2016 16:18
Show Gist options
  • Save thisMagpie/83ee82104d74d5cdba9d to your computer and use it in GitHub Desktop.
Save thisMagpie/83ee82104d74d5cdba9d 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/"
N = 50
x = [0.0]*N
y = [0.0]*N
for i in range(N):
x[i] = datetime.datetime.now()
y[i] = tmp0.getCelsius()
pylab.plot(x, y)
pylab.xlabel('Time')
pylab.ylabel('Temperature')
pylab.title('Temperature vs Time')
pylab.grid(True)
pylab.savefig("tempvstime_noninteractive.pdf")
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment