#include #define DHTPIN 4 //DHT21 #define DHTTYPE DHT21 DHT dht21(DHTPIN,DHTTYPE); float temp, hum; void setup() { Serial.begin(9600); dht21.begin(); } void loop() { temp = dht21.readTemperature(); hum = dht21.readHumidity(); // ComprobaciĆ³n erres de lectura if (isnan(hum) || isnan(temp)) { Serial.println("Error obteniendo los datos del sensor DHT11"); return; } Serial.print("Humedad: "); Serial.print(hum); Serial.println(" %"); Serial.print("Temperatura: "); Serial.print(temp); Serial.print(" *C "); delay(2000); }