File size: 529 Bytes
805a22d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
"""fcuWay.195

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1_wM8-D2155uGbQp3IrrSrFyx5QDsAq7J
"""

import RPi.GPIO as GPIO
import dht11
import time
GPIO.setmode(GPIO.BCM)
myDHT=dht11.DHT11(pin=17)
try:
  while True:
    result=myDHT.read()
    if result.is_valid():
      print('Temperature is:', result.temperature,'Humidity is: ',result.humidity)
    time.sleep(.2)
except KeyboardInterrupt:
  GPIO.cleanup()
  print('GPIO Ready to Perform')