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: DHT11.cpp
- Revision:
- 6:257e2ab66d0f
- Parent:
- 4:48798b126d93
- Child:
- 7:50f5c8efd967
diff -r da586c935e88 -r 257e2ab66d0f DHT11.cpp
--- a/DHT11.cpp Wed Sep 10 17:35:27 2014 +0000
+++ b/DHT11.cpp Wed Sep 10 17:43:14 2014 +0000
@@ -11,21 +11,18 @@
io_irq.rise(this, &DHT11::pos_edge);
io_irq.fall(this, &DHT11::neg_edge);
io_irq.disable_irq();
- init();
+ init();
+ first_time = true;
}
// Destructor
DHT11::~DHT11(void) {}
-// Reading the data bits from DHT11
+// Reading the data bits from the DHT11
int DHT11::readData()
{
// Initialize
- eod = false;
- err = OK;
- data = 0;
- cnt = 0;
- wdt = 0;
+ init();
// Checking the measurement frequency
if (t.read_ms() < 2000 & first_time == false) {
@@ -128,7 +125,6 @@
void DHT11::init(void)
{
t_pulse_us = 0;
- first_time = true;
data = 0;
chksum = 0;
cnt = 0;