Skip to content

jingl3s/DHT11-DHT22-Python-library-Orange-PI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DHT22 Python library This simple class can be used for reading temperature and humidity values from DHT22 sensor on Orange PI.

Fork with some patches from https://forum.armbian.com/topic/5718-need-help-with-dht11-temp-sensor-and-python-code/

My Case of usage

Usage

Example:

from pyA20.gpio import gpio
from pyA20.gpio import port
 
import dht
import time
import datetime
 
# initialize GPIO
PIN2 = port.PA6
gpio.init()
 
# read data using pin
instance = dht.DHT(pin=PIN2)
 
while True:
    result = instance.read()
    if result.is_valid():
        print("Last valid input: " + str(datetime.datetime.now()))
        print("Temperature: %.2f C" % result.temperature)
        print("Humidity: %.2f %%" % result.humidity)
 
    time.sleep(1)

Please see tutorial: http://www.piprojects.xyz/temperature-sensor-orange-pi-python-code/

Source project https://github.com/ionutpi/DHT22-Python-library-Orange-PI

About

Read temperature and humidity values from DHT22 sensor on Orange PI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%