Created
September 28, 2014 15:29
-
-
Save anoochit/55ae951cc63d5e5da99b to your computer and use it in GitHub Desktop.
example file for ds18b20 python module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from time import sleep | |
from ds18b20 import DS18B20 | |
def main(): | |
sensor = DS18B20() | |
while True: | |
temperatures = sensor.get_temperatures([DS18B20.DEGREES_C, DS18B20.DEGREES_F, DS18B20.KELVIN]) | |
print("Kelvin: %f" % temperatures[2]) | |
print("Degrees Celsius: %f" % temperatures[0]) | |
print("Degrees Fahrenheit: %f" % temperatures[1]) | |
print("=====================================") | |
sleep(1) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment