| # -*- 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') |