hello there,
i have a dht22 sensor connected to a raspberry pi. The connection is good as i execute the following code and i get temp and humidity results
import Adafruit_DHT
import time
import requests
import math
import random
TOKEN = “BBFF-xxxxx” # Put your TOKEN here
DEVICE_LABEL = “Raspberry” # Put your device label here
VARIABLE_LABEL_1 = “temperature” # Put your first variable label here
VARIABLE_LABEL_2 = “humidity” # Put your second variable label here
VARIABLE_LABEL_3 = “position” # Put your second variable label here
DHT_SENSOR = Adafruit_DHT.DHT22
DHT_PIN = 4
while True:
humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
while True:
try:
r = requests.post(‘http://things.ubidots.com/api/v1.6/devices/raspberry/?token={BBFF-VxxxxxxV}’, data=temperature())
print(‘Posting temperatures in Ubidots’)
print(temperature())
except:
pass
can you please provide me with the python scripi so i can upload temp and humidity results to ubidots (i have an account and i have the device connected)
Thanks in advance