pressure sensor
Fork of DHT22 by
Revision 1:5b62982a760a, committed 2015-08-18
- Comitter:
- Hagrass
- Date:
- Tue Aug 18 00:24:13 2015 +0000
- Parent:
- 0:7fd3ff04ae95
- Commit message:
- CANSAT
Changed in this revision
DHT22.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7fd3ff04ae95 -r 5b62982a760a DHT22.cpp --- a/DHT22.cpp Thu Oct 27 15:11:06 2011 +0000 +++ b/DHT22.cpp Tue Aug 18 00:24:13 2015 +0000 @@ -1,6 +1,17 @@ #include "DHT22.h" - - +void wt(int x) +{ + Timer timer1; + timer1.start(); + while(1) + { + if (timer1.read_ms()>=x) + { + timer1.reset(); + break; + } + } +} DHT22::DHT22(PinName pin) { _data_pin = pin; } @@ -18,10 +29,13 @@ int dht22_dat [5]; DHT22.output(); DHT22.write(0); + //wt(18); wait_ms(18); DHT22.write(1); DHT22.input(); + //wt(40/1000); wait_us(40); + // wt(80/1000); wait_us(80); int i,j,result=0; for (i=0; i<5; i++) { @@ -29,6 +43,7 @@ for (j=0; j<8; j++) { while (DHT22); while (!DHT22); + // wt(50/1000); wait_us(50); int p; p=DHT22;