Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of DHT-11Mine by
Diff: Airhumiditysensors/SEN11301P/DHT.h
- Revision:
- 1:da927cdfff38
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Airhumiditysensors/SEN11301P/DHT.h Wed Dec 10 06:43:09 2014 +0000
@@ -0,0 +1,57 @@
+
+#ifndef MBED_DHT_H
+#define MBED_DHT_H
+
+#include "mbed.h"
+
+enum eType{
+ DHT11 = 11,
+ SEN11301P = 11,
+ RHT01 = 11,
+ } ;
+
+enum eError {
+ ERROR_NONE = 0,
+ BUS_BUSY =1,
+ ERROR_NOT_PRESENT =2 ,
+ ERROR_ACK_TOO_LONG =3 ,
+ ERROR_SYNC_TIMEOUT = 4,
+ ERROR_DATA_TIMEOUT =5 ,
+ ERROR_CHECKSUM = 6,
+ ERROR_NO_PATIENCE =7
+} ;
+
+typedef enum {
+ CELCIUS =0 ,
+ FARENHEIT =1,
+ KELVIN=2
+} eScale;
+
+
+class DHT {
+
+public:
+
+ DHT(PinName pin,int DHTtype);
+ ~DHT();
+ int readData(void);
+ float ReadHumidity(void);
+ float ReadTemperature(eScale Scale);
+
+
+private:
+ time_t _lastReadTime;
+ float _lastTemperature;
+ float _lastHumidity;
+ PinName _pin;
+ bool _firsttime;
+ int _DHTtype;
+ int DHT_data[6];
+ float CalcTemperature();
+ float CalcHumidity();
+ float ConvertCelciustoFarenheit(float);
+ float ConvertCelciustoKelvin(float);
+
+};
+
+#endif
