Sensor de temperatura y humedad (DHT22)

Dependencies:   mbed RGBLed TextLCD Keypad

main.cpp

Committer:
davidnicholai
Date:
2016-07-28
Revision:
0:214ec6f2cde1
Child:
1:6d44a2138e64

File content as of revision 0:214ec6f2cde1:


#include "mbed.h"
#include "DHT22.h"
DHT22 dht22(PB_7);
int main() {
    double hum;
    double temp;
    
    printf("\r\nSetting up...\r\n");
    
    while (1) {
        dht22.sample() ;
        hum=dht22.getHumidity()/10.0;
        temp=dht22.getTemperature()/10.0;
        printf("temperature: %3.1f, humidity: %3.1f\n\r",temp,hum);
        wait(2);
    }
}