Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

DHT22 raspberry pi zero connector

import Adafruit_DHT

DHT_SENSOR = Adafruit_DHT.DHT22
DHT_PIN = 4

while True:
    humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)

    if humidity is not None and temperature is not None:
        print("Temp={0:0.1f}*C  Humidity={1:0.1f}%".format(temperature, humidity))
    else:
        print("Failed to retrieve data from humidity sensor")
Comment

PREVIOUS NEXT
Code Example
Python :: python count array length 
Python :: binary to decimal conversion python 
Python :: random torch tensor 
Python :: python numpy array size of n 
Python :: matplotlib dateformatter x axis 
Python :: add time and date to datetime 
Python :: python lists as dataframe rows 
Python :: reverse an array pyton 
Python :: how yo import python lib 
Python :: python nonlocal 
Python :: good python ide 
Python :: view all columns in pandas dataframe 
Python :: django check user admin 
Python :: lerp function 
Python :: python one line if statement without else 
Python :: ValueError: Found array with dim 3. Estimator expected <= 2. 
Python :: xml to excel python 
Python :: text widget get tkinter 
Python :: install python in docker file 
Python :: how to give bar plot groupby python different colors 
Python :: headless chrome python 
Python :: How are iloc and loc different? 
Python :: combination of 1 2 3 4 5 python 
Python :: string to array python 
Python :: isdigit python 
Python :: python pandas column where 
Python :: django in conda 
Python :: how to print a column from csv file in python 
Python :: algorithms for Determine the sum of al digits of n 
Python :: how to find the closest value in column python 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =