Skip to content

Instantly share code, notes, and snippets.

@AgustinParmisano
Created October 17, 2016 23:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AgustinParmisano/d8daa3f81869cde9fd334a23f49cc978 to your computer and use it in GitHub Desktop.
Save AgustinParmisano/d8daa3f81869cde9fd334a23f49cc978 to your computer and use it in GitHub Desktop.
from ubidots import ApiClient
from gpiozero import LightSensor
import time
import datetime
import Adafruit_DHT
ldr = LightSensor(4)
while True:
luz = ldr.value * 100
humidity, temperature = Adafruit_DHT.read_retry(11, 23)
print(luz)
time.sleep(0.2)
api = ApiClient(token='ATh21KIJr7x3CIgzx2NULvT1jWHard')
ldr_light = api.get_variable('580527a376254277d7a3c900')
dht11_humi = api.get_variable('58054dbc76254247d7e93a0f')
dht11_temp = api.get_variable('58054eb87625424e72c6fac8')
new_dht11_sens_humi = dht11_humi.save_value({'value':humidity})
new_dht11_sens_temp = dht11_temp.save_value({'value':temperature})
new_ldr_sens = ldr_light.save_value({'value':luz })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment