An eddied version of http://mbed.org/users/crazystick/code/DHT22/ for LPC11U24. All printf statements are removed and features requiring the real time clock are removed.
Dependents: RHT03_HelloWorld IOT_sensor_nfc CanSat_Alex cansat_alex_v1 ... more
Diff: RHT03.h
- Revision:
- 1:2bd5cffd60d0
- Parent:
- 0:24f59e3759a1
- Child:
- 2:b07365121071
--- a/RHT03.h Tue Aug 28 14:27:50 2012 +0000 +++ b/RHT03.h Tue Aug 28 14:36:18 2012 +0000 @@ -1,57 +1,57 @@ -/* mbed DHT22 Library - * Copyright (c) 2011, sford, http://mbed.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documnetation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef MBED_DHT22_H -#define MBED_DHT22_H - -#include "mbed.h" - - -#define DHT22_ERROR_VALUE -99.5 - -typedef enum { - DHT_ERROR_NONE = 0, - DHT_BUS_HUNG, - DHT_ERROR_NOT_PRESENT, - DHT_ERROR_ACK_TOO_LONG, - DHT_ERROR_SYNC_TIMEOUT, - DHT_ERROR_DATA_TIMEOUT, - DHT_ERROR_CHECKSUM, - DHT_ERROR_TOO_QUICK -} DHT22_ERROR; - -class DHT22 { -private: - time_t _lastReadTime; - PinName _data; - float _lastHumidity; - float _lastTemperature; -public: - DHT22(PinName Data); - ~DHT22(); - DHT22_ERROR readData(void); - float getHumidity(); - float getTemperatureC(); - void clockReset(); -}; - -#endif /*_DHT22_H_*/ +/* mbed RHT03 Library + * Copyright (c) 2011, sford, http://mbed.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documnetation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MBED_RHT03_H +#define MBED_RHT03_H + +#include "mbed.h" + + +#define RHT03_ERROR_VALUE -99.5 + +typedef enum { + RHT_ERROR_NONE = 0, + RHT_BUS_HUNG, + RHT_ERROR_NOT_PRESENT, + RHT_ERROR_ACK_TOO_LONG, + RHT_ERROR_SYNC_TIMEOUT, + RHT_ERROR_DATA_TIMEOUT, + RHT_ERROR_CHECKSUM, + RHT_ERROR_TOO_QUICK +} RHT03_ERROR; + +class RHT03 { +private: + time_t _lastReadTime; + PinName _data; + float _lastHumidity; + float _lastTemperature; +public: + RHT03(PinName Data); + ~RHT03(); + RHT03_ERROR readData(void); + float getHumidity(); + float getTemperatureC(); + void clockReset(); +}; + +#endif /*_RHT03_H_*/