Simple temperature reading
This commit is contained in:
parent
e2592b6454
commit
cc5a97ffa4
1 changed files with 29 additions and 1 deletions
|
@ -1,3 +1,31 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
print 'nothing yet'
|
import smbus
|
||||||
|
|
||||||
|
bus = smbus.SMBus(1)
|
||||||
|
address = 0x49
|
||||||
|
|
||||||
|
print 'Start: ' + hex(bus.read_byte_data(address, 0xEE))
|
||||||
|
|
||||||
|
tempFull = bus.read_byte_data(address, 0xAA)
|
||||||
|
print 'Temp (1 deg): ' + str(tempFull)
|
||||||
|
|
||||||
|
halfDegreeTemp = bus.read_word_data(address, 0xAA)
|
||||||
|
tempHalf = halfDegreeTemp & 0x00FF
|
||||||
|
if halfDegreeTemp & 0xFF00:
|
||||||
|
tempHalf += 0.5
|
||||||
|
print 'Temp (0.5 deg): ' + str(tempHalf)
|
||||||
|
|
||||||
|
counter = bus.read_word_data(address, 0xA8)
|
||||||
|
print 'Counter: ' + str(counter)
|
||||||
|
|
||||||
|
slope = bus.read_word_data(address, 0xA9)
|
||||||
|
print 'Slope: ' + str(slope)
|
||||||
|
|
||||||
|
tempHi = tempFull - 0.25 + float(slope - counter) / slope
|
||||||
|
print 'Temp (hi-res): ' + str(tempHi)
|
||||||
|
|
||||||
|
print 'End: ' + hex(bus.read_byte_data(address, 0x22))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue