A library for the use of AM2303 (a.k.a. DHT22), a temperature and humidity sensor.
Dependents: AM2303_Hello_World
Fork of DHT11 by
Revision 7:50f5c8efd967, committed 2014-09-10
- Comitter:
- s_inoue_mbed
- Date:
- Wed Sep 10 17:48:35 2014 +0000
- Parent:
- 6:257e2ab66d0f
- Child:
- 8:160047ca45bf
- Commit message:
- readData() has been simplified.
Changed in this revision
DHT11.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DHT11.cpp Wed Sep 10 17:43:14 2014 +0000 +++ b/DHT11.cpp Wed Sep 10 17:48:35 2014 +0000 @@ -43,8 +43,8 @@ do { io = 0; } while (t.read_ms() < 18); + io = 1; io.input(); - io = 1; // Waiting for the start of the response signal t.reset(); @@ -52,7 +52,6 @@ do { if (t.read_us() > 100) { io.input(); - io = 1; return NOT_PRESENT; } } while (io == 1); @@ -63,7 +62,6 @@ do { if (t.read_us() > 100) { io.input(); - io = 1; return NOT_READY; } } while (io == 0);