DHT11 with Raspberry PI

Viewing a single blog post

To install the Adafruit DHT11 library:

1. Enter this at the command prompt to download the library:

git clone https://github.com/adafruit/Adafruit_Python_DHT.git

2. Change directories with:

cd Adafruit_Python_DHT

3. Now enter this:

sudo apt-get install build-essential python-dev

4. Then install the library with:

sudo python setup.py install

OUTPUT TO AN SSH TERMINAL

This Python program will output the temperature and humidity readings to an SSH terminal

 

 

 

#!/usr/bin/python
import sys
import Adafruit_DHT

while True:

humidity, temperature = Adafruit_DHT.read_retry(11, 4) #DHT11, GPIO4

print 'Temp: {0:0.1f} C Humidity: {1:0.1f} %'.format(temperature, humidity)

 

Download

 

 

 

 
 

 

Posted in Internet on May 31, 2018


Comments

Please sign in to comment!