Created
April 21, 2021 20:33
-
-
Save piaverous/d81b0e98e5474aeab67937082fa4a1ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Adafruit_DHT | |
import time | |
SENSOR_TYPE = Adafruit_DHT.DHT11 | |
GPIO_PIN_NUMBER = 4 | |
if __name__ == "__main__" : | |
start_time = time.time() | |
humidity, temperature = Adafruit_DHT.read_retry( | |
SENSOR_TYPE, | |
GPIO_PIN_NUMBER | |
) | |
end_time = time.time() | |
print(f"Measured Temp={temperature}°C | Hum={humidity}%") | |
print(f"Measurement took {end_time-start_time}s") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment