DHT11 Python library
This simple class can be used for reading temperature and humidity values from DHT11 sensor on Raspberry Pi.
Installation
To install, clone the repository, cd into it, and run:
python3 -m pip install .
Usage
- Instantiate the
DHT11class with the pin number as constructor parameter. - Call
read()method, which will returnDHT11Resultobject with actual values and error code.
For example:
import RPi.GPIO as GPIO
import dht11
# initialize GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.cleanup()
# read data using pin 14
instance = dht11.DHT11(pin = 14)
result = instance.read()
if result.is_valid():
print("Temperature: %-3.1f C" % result.temperature)
print("Humidity: %-3.1f %%" % result.humidity)
else:
print("Error: %d" % result.error_code)
For working example, see dht11_example.py (you probably need to adjust pin for your configuration)
License
This project is licensed under the terms of the MIT license.
Release files for dht11 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dht11-0.1.0.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dht11-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / dht11-0.1.0.tar.gz
| Download URL | dht11-0.1.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
148de58f2555ca05b85b0b3fadb2fcf8070ec7195daade4cb355685265a933c2
|
|
BLAKE2b-256 checksum How to use checksums |
f7f9cda6ad954c223849271c2fdf280eec921d2ef377bc90dc41e33e84dc8cb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
|
Release files / dht11-0.1.0-py3-none-any.whl
| Download URL | dht11-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69d1314322d409a0de7eff6df2896e98ae8f8274a597416e75dd1e7e2c2d23d9
|
|
BLAKE2b-256 checksum How to use checksums |
64a15782c51fa87f641e50017ec10418435784ba7d75f5ea2e113317071d1ddf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
|