I'm trying to upload some data into thingspeak from DHT11 sensor.
Here is the code:
import sys import Adafruit_DHT import urllib while True: print("STARTS UPLOADING...") baseURL = "https://api.thingspeak.com/update?api_key=0SKA2NQJ31NBMJA1" try: humidity, temperature = Adafruit_DHT.read(11,4) hum = str(humidity) temp = str(temperature) f = urllib.urlopen(baseURL +"&field1="+temp+"&field2="+hum) print(f.read()) print(temp+ " " + hum+ " " ) f.close() except: print('exiting.') break
Whenever I execute this program, it does not enter the data into thingspeak. It just exits.
Need some immediate help.