Moin Md
Moin Md

Reputation: 57

Arduino UNO displaying -999 value for humidity and temperature

I am using DHT11 sensor for displaying humidity and temperature values. I dont know where I did wrong. It's displaying only -999 value for both humidity and temperature. Here's my code

#include <dht.h>

dht DHT;

#define DHT11_PIN A0

void setup(){
Serial.begin(9600);
}

void loop()
{
  DHT.read11(DHT11_PIN);
  Serial.print("Temperature = ");
  Serial.println(DHT.temperature);
  Serial.print("Humidity = ");
  Serial.println(DHT.humidity);
  delay(1000);
}

Picture of Arduino

Output

Upvotes: 1

Views: 703

Answers (1)

Abhishek
Abhishek

Reputation: 64

Your code seems to be correct. Try to make different connections and use different libraries. If it is still not solved then I recommend you to get the another dht11 sensor. I am sure it will work!!

#include<dht.h>

dht DHT;

#define DHT11_PIN A0

void setup(){
Serial.begin(9600);
}

void loop()
{
 DHT.read11(DHT11_PIN);
 Serial.print("Temperature = ");
 Serial.println(DHT.temperature);
 Serial.print("Humidity = ");
 Serial.println(DHT.humidity);
 delay(1000);
}

Upvotes: 1

Related Questions