=DHT22 Temperature and Humidity Sensor= The DHT-22 is a low cost humidity and temperature sensor with a single wire digital interface. The sensor is calibrated and doesn\\\'t require extra components so you can get right to measuring relative humidity and temperature. [[http://dlnmh9ip6v2uc.cloudfront.net/images/products/10167-01_i_ma.jpg]] Features: * 3.3-6V Input * 1-1.5mA measuring current * 40-50 uA standby current * Humidity from 0-100% RH * -40 - 80 degrees C temperature range * +-2% RH accuracy * +-0.5 degrees C ***(same as RHT03 www.humiditycn.com)*** Available as http://www.sparkfun.com/products/10167 | DHT22(pin) | Function | mbed | | 1 - VDD | VDD-power supply (3.3-6V) | (Vout) 5V | | 2 - DATA | Single pin signal | p15 | | 3 - NULL | | | | 4 - GND | Connect to ground | GND | == Library == <<library /users/hwkit/libraries/DHT22/latest/docs/DHT22_8h_source.html>> <<library users=\"\" hwkit=\"\" libraries=\"\" dht22=\"\" latest=\"\" docs=\"\" dht22_8cpp_source.html=\"\">></library>
Diff: DHT22.h
- Revision:
- 1:5b20ff4fd227
- Parent:
- 0:547e68daeb1b
--- a/DHT22.h Tue Jun 21 03:44:05 2011 +0000 +++ b/DHT22.h Mon Jul 04 07:35:03 2011 +0000 @@ -24,6 +24,7 @@ #define MBED_DHT22_H #include "mbed.h" +#include "NokiaLCD.h" /** * Currently supports DHT22 (SparkFun Electronics) @@ -45,6 +46,10 @@ * * int main() { * err=dth22.readData(); + * if (err==0) { + printf("Temperature is %f.2 C\n",dht22.getTemperature()); + printf("Humidity is %f.2 \%\n",dht22.getHumidity()); + } * * */ @@ -64,14 +69,10 @@ class DHT22 { private: - uint8_t _bitmask; - volatile uint8_t *_baseReg; time_t _lastReadTime; - PinName _vcc, _data; - int m_addr; + PinName _data; float _lastHumidity; float _lastTemperature; - public: DHT22(PinName Data); ~DHT22();