Author | Sebastien Lelong, Copyright (c) 2011, all rights reserved. |
Adapted-by | |
Compiler | >=2.4o |
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.
- datasheet: http://www.robotshop.com/PDF/dht11.pdf - arduino playground: http://arduino.cc/playground/Main/DHT11Lib
const byte DHT11_TIMEOUT = 2
const byte DHT11_OK = 0
var byte dht11_temperature = 0
const byte DHT11_ERR = 1
var byte _dht11_buffer[5] = {0,0,0,0,0}
var byte dht11_humidity = 0
const byte DHT11_TIMEOUT = 2
No documentation found
const byte DHT11_OK = 0
user-friendly status
var byte dht11_temperature = 0
global variables to store temperature and humidity values
const byte DHT11_ERR = 1
No documentation found
var byte _dht11_buffer[5] = {0,0,0,0,0}
No documentation found
var byte dht11_humidity = 0
No documentation found
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
18f27j53 | 18f27j53_dht11.jal |