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.
Diff: main.cpp
- Revision:
- 0:c0bc947cdcea
diff -r 000000000000 -r c0bc947cdcea main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Jan 04 14:46:37 2016 +0000
@@ -0,0 +1,25 @@
+/*
+ * (C) The University of Kent and Simon Cooksey 2015.
+ */
+
+#include "mbed.h"
+
+#include "dht22.h"
+
+Serial host(USBTX, USBRX);
+DHT22 dht22(PTB18);
+
+
+int main()
+{
+ DHT22_data_t dht22_data;
+ while (true) {
+ dht22.read(&dht22_data);
+
+ float temperature = dht22_data.temp / 10.0f;
+ float humidity = dht22_data.humidity / 10.0f;
+
+ host.printf("Temperature: %2.2f Humidity: %2.2f%%\r\n", temperature, humidity);
+ wait_ms(500);
+ }
+}
\ No newline at end of file