[text] iot working

Viewer

copydownloadembedprintName: iot working
  1. import thingspeak
  2. import random
  3. import time
  4.  
  5. channel_id=2537691
  6.  
  7. write_key='UD09I78L3WFL6URV'
  8. channel=thingspeak.Channel(id=channel_id,api_key=write_key)
  9.  
  10. while True:
  11.     # humidity,temperature=Adafruit_DHT.read_retry(DHT_SENSOR,DHT_PIN)
  12.     # if humidity is not None and temperature is not None:
  13.     #     print("Temperature={0:0.1f}*C Humidity={1:0.1f}%".format(temperature,humidity))
  14.     response=channel.update({'field1':random.randint(22,30),'field2':random.randint(10,90)})
  15.     # else:
  16.     #     print("sensor failure. Check Wiring")
  17.     # time.sleep(2)

Editor

You can edit this paste and save as new:


File Description
  • iot working
  • Paste Code
  • 06 May-2024
  • 575 Bytes
You can Share it: