mohamed gamal
/
DHT_CANSAT
DHT_CANSAT
Fork of DHT_TEST2 by
main.cpp@0:2dbb2497beb6, 2015-08-04 (annotated)
- Committer:
- mohamedgamal
- Date:
- Tue Aug 04 12:48:29 2015 +0000
- Revision:
- 0:2dbb2497beb6
DHT_TEST2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mohamedgamal | 0:2dbb2497beb6 | 1 | #include "mbed.h" |
mohamedgamal | 0:2dbb2497beb6 | 2 | #include "DHT22.h" |
mohamedgamal | 0:2dbb2497beb6 | 3 | DHT22 dht22(p23); |
mohamedgamal | 0:2dbb2497beb6 | 4 | int main() { |
mohamedgamal | 0:2dbb2497beb6 | 5 | int hum; |
mohamedgamal | 0:2dbb2497beb6 | 6 | int temp; |
mohamedgamal | 0:2dbb2497beb6 | 7 | printf("Start\n"); |
mohamedgamal | 0:2dbb2497beb6 | 8 | printf("\r\nSetting up...\r\n"); |
mohamedgamal | 0:2dbb2497beb6 | 9 | while (1) { |
mohamedgamal | 0:2dbb2497beb6 | 10 | dht22.sample() ; |
mohamedgamal | 0:2dbb2497beb6 | 11 | hum=dht22.getHumidity()/10.0; |
mohamedgamal | 0:2dbb2497beb6 | 12 | temp=dht22.getTemperature()/10.0; |
mohamedgamal | 0:2dbb2497beb6 | 13 | printf("temp: %d , hum:%d ",temp,hum); |
mohamedgamal | 0:2dbb2497beb6 | 14 | wait(1); |
mohamedgamal | 0:2dbb2497beb6 | 15 | }} |