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-11 by
Revision 1:d9be5eb8bdeb, committed 2014-04-09
- Comitter:
- lanmaomao7
- Date:
- Wed Apr 09 20:11:10 2014 +0000
- Parent:
- 0:6e5d3c6e8715
- Commit message:
- dht11
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6e5d3c6e8715 -r d9be5eb8bdeb main.cpp
--- a/main.cpp Mon Mar 03 19:57:32 2014 +0000
+++ b/main.cpp Wed Apr 09 20:11:10 2014 +0000
@@ -3,7 +3,7 @@
DigitalOut myled(LED1);
-DHT sensor(PTD4,SEN11301P); // Use the SEN11301P sensor
+DHT sensor(PTC7,SEN11301P); // Use the SEN11301P sensor
int main() {
int err;
@@ -25,4 +25,28 @@
myled = 0;
wait(15);
}
+}
+float Humidity_Sensor_Temperature(){
+ int err;
+ wait(1);
+ err = sensor.readData();
+ if (err == 0)
+ return sensor.ReadTemperature(CELCIUS);
+ else return err;
+}
+float Humidity_Sensor_Humidity(){
+ int err;
+ wait(1);
+ err = sensor.readData();
+ if (err == 0)
+ return sensor.ReadHumidity();
+ else return err;
+}
+float Humidity_Sensor_Dewpoint(){
+ int err;
+ wait(1);
+ err = sensor.readData();
+ if (err == 0)
+ return sensor.CalcdewPoint(sensor.ReadTemperature(CELCIUS), sensor.ReadHumidity());
+ else return err;
}
\ No newline at end of file
