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

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

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

Definition at line 137 of file dht11.py.

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

Definition at line 112 of file dht11.py.

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

Definition at line 100 of file dht11.py.

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

Definition at line 71 of file dht11.py.

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

Definition at line 128 of file dht11.py.

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.

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

Definition at line 143 of file dht11.py.

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

Definition at line 118 of file dht11.py.

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

Definition at line 47 of file dht11.py.

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

dht11.DHT11.bit

Definition at line 32 of file dht11.py.

dht11.DHT11.checksum

Definition at line 79 of file dht11.py.

dht11.DHT11.either_edge_cb

Definition at line 35 of file dht11.py.

dht11.DHT11.gpio

Definition at line 30 of file dht11.py.

dht11.DHT11.high_tick

Definition at line 31 of file dht11.py.

dht11.DHT11.humidity

Definition at line 34 of file dht11.py.

dht11.DHT11.pi

Definition at line 29 of file dht11.py.

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 Tue Oct 20 2020 03:35:58