Public Member Functions | Public Attributes | Private Member Functions | List of all members
dht11.DHT11 Class Reference
Inheritance diagram for dht11.DHT11:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, pi, gpio)
 
def __iter__ (self)
 
def close (self)
 
def either_edge_callback (self, gpio, level, tick)
 
def next (self)
 
def read (self)
 
def register_callbacks (self)
 
def setup (self)
 

Public Attributes

 bit
 
 checksum
 
 either_edge_cb
 
 gpio
 
 high_tick
 
 humidity
 
 pi
 
 temperature
 

Private Member Functions

def _edge_EITHER (self, tick, diff)
 
def _edge_FALL (self, tick, diff)
 
def _edge_RISE (self, tick, diff)
 

Detailed Description

The DHT11 class is a stripped version of the DHT22 sensor code by joan2937.
You can find the initial implementation here:
- https://github.com/srounet/pigpio/tree/master/EXAMPLES/Python/DHT22_AM2302_SENSOR

example code:
>>> pi = pigpio.pi()
>>> sensor = DHT11(pi, 4) # 4 is the data GPIO pin connected to your sensor
>>> for response in sensor:
....    print("Temperature: {}".format(response['temperature']))
....    print("Humidity: {}".format(response['humidity']))

Definition at line 10 of file dht11.py.

Constructor & Destructor Documentation

◆ __init__()

def dht11.DHT11.__init__ (   self,
  pi,
  gpio 
)
pi (pigpio): an instance of pigpio
gpio (int): gpio pin number

Definition at line 24 of file dht11.py.

Member Function Documentation

◆ __iter__()

def dht11.DHT11.__iter__ (   self)
Support the iterator protocol.

Definition at line 137 of file dht11.py.

◆ _edge_EITHER()

def dht11.DHT11._edge_EITHER (   self,
  tick,
  diff 
)
private
Handle Either signal.

Definition at line 112 of file dht11.py.

◆ _edge_FALL()

def dht11.DHT11._edge_FALL (   self,
  tick,
  diff 
)
private
Handle Fall signal.

Definition at line 100 of file dht11.py.

◆ _edge_RISE()

def dht11.DHT11._edge_RISE (   self,
  tick,
  diff 
)
private
Handle Rise signal.

Definition at line 71 of file dht11.py.

◆ close()

def dht11.DHT11.close (   self)
Stop reading sensor, remove callbacks.

Definition at line 128 of file dht11.py.

◆ either_edge_callback()

def dht11.DHT11.either_edge_callback (   self,
  gpio,
  level,
  tick 
)
Either Edge callbacks, called each time the gpio edge changes.
Accumulate the 40 data bits from the dht11 sensor.

Definition at line 57 of file dht11.py.

◆ next()

def dht11.DHT11.next (   self)
Call the read method and return temperature and humidity informations.

Definition at line 143 of file dht11.py.

◆ read()

def dht11.DHT11.read (   self)
Start reading over DHT11 sensor.

Definition at line 118 of file dht11.py.

◆ register_callbacks()

def dht11.DHT11.register_callbacks (   self)
Monitors RISING_EDGE changes using callback.

Definition at line 47 of file dht11.py.

◆ setup()

def dht11.DHT11.setup (   self)
Clears the internal gpio pull-up/down resistor.
Kills any watchdogs.

Definition at line 38 of file dht11.py.

Member Data Documentation

◆ bit

dht11.DHT11.bit

Definition at line 32 of file dht11.py.

◆ checksum

dht11.DHT11.checksum

Definition at line 79 of file dht11.py.

◆ either_edge_cb

dht11.DHT11.either_edge_cb

Definition at line 35 of file dht11.py.

◆ gpio

dht11.DHT11.gpio

Definition at line 30 of file dht11.py.

◆ high_tick

dht11.DHT11.high_tick

Definition at line 31 of file dht11.py.

◆ humidity

dht11.DHT11.humidity

Definition at line 34 of file dht11.py.

◆ pi

dht11.DHT11.pi

Definition at line 29 of file dht11.py.

◆ temperature

dht11.DHT11.temperature

Definition at line 33 of file dht11.py.


The documentation for this class was generated from the following file:


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Fri Aug 2 2024 09:40:57