DHT11 used for Temperature & Humidity sensor.
Dependents: LoRaWAN_mbed_lmic_agriculture_app
Fork of DHT by
Diff: DHT.h
- Revision:
- 4:0c34c98a87ec
- Parent:
- 2:df22ddf10d75
--- a/DHT.h Sat May 28 11:11:34 2016 +0000 +++ b/DHT.h Mon Apr 02 12:06:29 2018 +0000 @@ -5,7 +5,7 @@ * SEN11301P, Grove - Temperature&Humidity Sensor (Seeed Studio) * SEN51035P, Grove - Temperature&Humidity Sensor Pro (Seeed Studio) * AM2302 , temperature-humidity sensor - * RHT01,RHT02, RHT03 , Humidity and Temperature Sensor (Sparkfun) + * RHT01,RHT02, RHT03, Humidity and Temperature Sensor (Sparkfun) * * Copyright (C) Wim De Roeve * based on DHT22 sensor library by HO WING KIT @@ -28,6 +28,20 @@ * 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. + * + * ///////////////////////////////////////////////////////////////////////////// + * + * Used by Giorgos Tsapparellas for Internet of Things (IoT) smart monitoring + * device for agriculture using LoRaWAN technology. + * + * Sensor Used: DHT11 - Digital-output Humidity and Temperature sensor. + * + * Date of issued copy: 10 January 2018 + * + * Modifications: + * - No external modifications of the existing "AS IT IS" software. + * - Added some external comments for meeting good principles of + * source code re-usability. */ #ifndef MBED_DHT_H @@ -35,6 +49,7 @@ #include "mbed.h" +// eType data structure regarding sensor selection (either 11 or 22 value). typedef enum eType eType; enum eType { DHT11 = 11, @@ -47,6 +62,7 @@ RHT03 = 22 }; +// eError enumeration regarding possible sensor's errors (from 0 to 7). typedef enum eError eError; enum eError { ERROR_NONE = 0, @@ -59,6 +75,7 @@ ERROR_NO_PATIENCE }; +// eScale enumeration for possible temperature's scales (from 0 to 3=2). typedef enum eScale eScale; enum eScale { CELCIUS = 0, @@ -66,10 +83,10 @@ KELVIN }; - +/* Public and private declarations of DHT class. */ class DHT { - +/* Public function callbacks of DHT class. */ public: DHT(PinName pin, eType DHTtype); @@ -80,6 +97,7 @@ float CalcdewPoint(float const celsius, float const humidity); float CalcdewPointFast(float const celsius, float const humidity); +/* Private variables declarations and function callbacks of DHT class. */ private: time_t _lastReadTime; float _lastTemperature;