Sensor de temperatura y humedad (DHT22)
Dependencies: mbed RGBLed TextLCD Keypad
Diff: main.cpp
- Revision:
- 0:214ec6f2cde1
- Child:
- 1:6d44a2138e64
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 28 20:59:39 2016 +0000 @@ -0,0 +1,19 @@ + +#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); + } +} + \ No newline at end of file