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
RHT03.h
00001 /* mbed RHT03 Library 00002 Copyright (c) 2011, sford, http://mbed.org 00003 Modifications by Tristan Hughes 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy 00006 of this software and associated documnetation files (the "Software"), to deal 00007 in the Software without restriction, including without limitation the rights 00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 copies of the Software, and to permit persons to whom the Software is 00010 furished to do so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in 00013 all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 THE SOFTWARE. 00022 */ 00023 00024 #ifndef MBED_RHT03_H 00025 #define MBED_RHT03_H 00026 00027 #include "mbed.h" 00028 00029 00030 #define RHT03_ERROR_VALUE -99.5 00031 00032 typedef enum { 00033 RHT_ERROR_NONE = 0, 00034 RHT_BUS_HUNG, 00035 RHT_ERROR_NOT_PRESENT, 00036 RHT_ERROR_ACK_TOO_LONG, 00037 RHT_ERROR_SYNC_TIMEOUT, 00038 RHT_ERROR_DATA_TIMEOUT, 00039 RHT_ERROR_CHECKSUM, 00040 RHT_ERROR_TOO_QUICK 00041 } RHT03_ERROR; 00042 00043 /** RHT03 interface class for reading data from the sensor */ 00044 class RHT03 00045 { 00046 private: 00047 time_t _lastReadTime; 00048 PinName _data; 00049 float _lastHumidity; 00050 float _lastTemperature; 00051 public: 00052 /** Configure data pin 00053 * @param Data The data pin the RHT03 is attached to 00054 */ 00055 RHT03(PinName Data); 00056 ~RHT03(); 00057 /** Reads data from the RHT03 00058 * @return error type or successful read 00059 */ 00060 RHT03_ERROR readData(void); 00061 /** Gives current humidity value 00062 * @return humidity value 00063 */ 00064 float getHumidity(); 00065 /** Gives current temperature value 00066 * @return temperature value 00067 */ 00068 float getTemperatureC(); 00069 void clockReset(); 00070 }; 00071 00072 #endif /*_RHT03_H_*/
Generated on Tue Jul 12 2022 17:09:55 by 1.7.2