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

Committer:
tristanjph
Date:
2012-08-28
Revision:
1:2bd5cffd60d0
Parent:
0:24f59e3759a1
Child:
2:b07365121071

File content as of revision 1:2bd5cffd60d0:

/* 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_*/