moha fehri
/
TEMPHUMRUCHE2
RUCHE
temphum.cpp@4:d4aa7422d519, 2019-01-15 (annotated)
- Committer:
- moham
- Date:
- Tue Jan 15 16:47:09 2019 +0000
- Revision:
- 4:d4aa7422d519
- Child:
- 5:4510dda988cf
RUCHE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
moham | 4:d4aa7422d519 | 1 | #include "mbed.h" |
moham | 4:d4aa7422d519 | 2 | #include "DHT22.h" |
moham | 4:d4aa7422d519 | 3 | #include "string.h" |
moham | 4:d4aa7422d519 | 4 | DHT22 dht22(D3); |
moham | 4:d4aa7422d519 | 5 | Serial pc(USBTX,USBRX); |
moham | 4:d4aa7422d519 | 6 | int main() { |
moham | 4:d4aa7422d519 | 7 | |
moham | 4:d4aa7422d519 | 8 | pc.baud(9600); |
moham | 4:d4aa7422d519 | 9 | int humidite; |
moham | 4:d4aa7422d519 | 10 | int temperature; |
moham | 4:d4aa7422d519 | 11 | while(1) { |
moham | 4:d4aa7422d519 | 12 | |
moham | 4:d4aa7422d519 | 13 | dht22.sample() ; |
moham | 4:d4aa7422d519 | 14 | humidite=dht22.getHumidity()/10.0; |
moham | 4:d4aa7422d519 | 15 | temperature=dht22.getTemperature()/10.0; |
moham | 4:d4aa7422d519 | 16 | pc.printf("temperature: %d humidity: %d\n\r",temperature,humidite); |
moham | 4:d4aa7422d519 | 17 | wait(1); }} |