Mercurial > templog
comparison web/test.py @ 381:83c83014e5e3
report raw ds18b20 values instead
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 03 Jul 2012 22:44:21 +0800 |
parents | 1e22eaf93620 |
children |
comparison
equal
deleted
inserted
replaced
380:180dc60140a4 | 381:83c83014e5e3 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 import log | |
3 import time | 2 import time |
3 import struct | |
4 import sys | |
5 import binascii | |
4 | 6 |
5 log.sensor_update("test1", [22,22,22.1,22.4,22.5], time.time() - 10, 300) | 7 def convert_ds18b20_12bit(reading): |
8 value = struct.unpack('>h', binascii.unhexlify(reading))[0] | |
9 return value * 0.0625 | |
10 | |
11 if __name__ == '__main__': | |
12 print convert_ds18b20_12bit(sys.argv[1]) |