# temperature_humidity_dht11

DHT11 library

Author | Sebastien Lelong, Copyright © 2011, all rights reserved.
Adapted-by |
Compiler | >=2.4o

Description

    DHT11 is a cheap temperature and humidity sensor. This library
    accesses this module and reads values from it.
    .
    Accessing the module is quite straight forward and requires one signal
    pin and a pullup resistor. This pin will be set as output and input by the
    library itself, and is used to activate the sensor, then actually getting
    values. Temp & humidity values comes in one frame from the sensor. Library
    split both value type and set global variables. This means these global
    variables store the last accessed value. Variables are word storing floating
    point value. Eg: when humidity is 652, then it means its 65.2
    .
    This library will also work with the more accurate DHT22 version, just declare
    a "USE_DHT22" const set to true. DHT22 is also known as RHT03. Careful though,
    most people report RHT03 needs 5V to properly work, and DHT22 at least 3V3. If
    you receive timeouts with these when powered with 3V3, give a try with 5V.

Sources

      - datasheet: http://www.robotshop.com/PDF/dht11.pdf
      - arduino playground: http://arduino.cc/playground/Main/DHT11Lib

Dependencies

- delay

## Summary

### Global variables/contants

- `const byte DHT11_TIMEOUT = 2`
- `const byte DHT11_OK = 0`
- `const byte DHT11_ERR = 1`
- `var word dht11_temperature = 0`
- `var byte _dht11_buffer[5] = {0,0,0,0,0}`
- `var word dht11_humidity = 0`

### Procedures

### Functions

- `dht11_read() return byte`

## API details

### Global variables/contants

- `const byte DHT11_TIMEOUT = 2`

  No documentation found

- `const byte DHT11_OK = 0`

      user-friendly status

- `const byte DHT11_ERR = 1`

  No documentation found

- `var word dht11_temperature = 0`

      global variables to store temperature and humidity values

- `var byte _dht11_buffer[5] = {0,0,0,0,0}`

  No documentation found

- `var word dht11_humidity = 0`

  No documentation found

### Procedures

### Functions

- `dht11_read() return byte`

      Read temperature and humidity value. Expect existing aliases on a signal pin:
      * pin_dht11
      * pin_dht11_direction
      Returns a byte showing result status,using constants defined by the lib:
      DHT11_OK: successful reading, global variables are set
      DHT11_ERR: checksum error while reading
      DHT11_TIMEOUT: too many time occurs before readings, give up.
      Calling code must check these returned value in order to know if
      global variables are actually storing updated values

## Related samples

Here are the list of samples which use this library:

18f27j53 | 18f27j53_dht11.jal