Created
February 5, 2017 03:13
-
-
Save mid0111/ed429d977414ffe3b63c5777242193fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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/python | |
# -*- coding: utf-8 -*- | |
from time import sleep | |
import sys | |
import Adafruit_DHT | |
import ambient | |
pin = 23 | |
ambi = ambient.Ambient(970, "bb04bfa265692394") | |
while True: | |
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.AM2302, pin) | |
if humidity is not None and temperature is not None: | |
r = ambi.send({"d1": temperature, "d2": humidity}) | |
print 'Status code: %d' % r.status_code | |
sleep(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment