![](/media/cache/profiles/f095cedd23b99f1696fc8caecbcf257e.jpg.50x50_q85.jpg)
mbed Weather Platform firmware http://mbed.org/users/okini3939/notebook/mbed-weather-platform-firmware/
Dependencies: EthernetNetIf SDHCFileSystem I2CLEDDisp Agentbed NTPClient_NetServices mbed BMP085 HTTPClient ConfigFile I2CLCD
Diff: SHT_v1/SHT.h
- Revision:
- 0:d7b4484099bf
diff -r 000000000000 -r d7b4484099bf SHT_v1/SHT.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SHT_v1/SHT.h Wed May 18 15:01:56 2011 +0000 @@ -0,0 +1,66 @@ +/* mbed module to use a Sensirion SHT1x /SHT7x sensor + * Copyright (c) 2007-2009 Stephen McGarry + * Released under the MIT License: http://mbed.org/license/mit + */ +#ifndef SHT_H +#define SHT_H + +#include "mbed.h" + +enum SHT_acc { + SHT_low=0, + SHT_high=1 +}; + +typedef unsigned char byte; + +class SHT : public Base { +public: + /* Constructor: SHT + * Creates an SHT interface connected to specific pins. + * + */ + SHT(PinName p_sclk, PinName p_data, SHT_acc p_accuracy); + + /* Functions + */ + float get_temperature(); // get the most recent temp reading + float get_humidity(); // get the most recent humidity reading + float get_dewpoint(); // get the most recent dewpoint value + void update(SHT_acc accuracy); // update stored values from sensor + +protected: + byte read_byte(bool send_ack); + char write_byte(byte value); + void trans_start(void); + void connection_reset(void); + char soft_reset(); + char read_status(byte &value); + char write_status(byte value); + char measure(int &value, byte mode); + void calculate(); + + DigitalOut sclk; + DigitalInOut data; + SHT_acc accuracy; // will we use high or low accuracy mode on the sensor + + float temperature; // calculated from sensor reading + float humidity; + float dewpoint; + int temp,hum; // integer values from sensor before conversion + + enum commands { + com_read_status_reg=0x06, + com_write_status_reg=0x07, + com_measure_temp=0x03, + com_measure_humid=0x05, + com_reset=0x1E + }; + + enum acks { + no_ack=0, + send_ack=1 + }; +}; + +#endif \ No newline at end of file