Skip to content

Instantly share code, notes, and snippets.

@thisMagpie
Last active February 19, 2016 13:21
Show Gist options
  • Save thisMagpie/13dc53c707c24ef38931 to your computer and use it in GitHub Desktop.
Save thisMagpie/13dc53c707c24ef38931 to your computer and use it in GitHub Desktop.
from webiopi.devices.sensor import DS18S20
import datetime
import pylab
import math
# sensors found with "ls /sys/bus/w1/devices/"
tmp0 = DS18S20(slave="10-000802de0ee7")
tmp1 = DS18S20(slave="10-000802de4b20")
N = 50
y0 = [0.0]*N
y1 = [0.0]*N
for i in range(N):
y0[i] = tmp0.getCelsius()
y1[i] = tmp1.getCelsius()
pylab.hist((y0,y1), N, range=[y0[0] - 0.2,y0[0] + .2])
pylab.xlabel('Temperature')
pylab.ylabel('Frequency')
pylab.title('Temperature vs Frequency')
pylab.savefig('tempurature_hist.png')
pylab.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment