I'm new in the Arduino world and today i was trying to make a simple program to show the temparature an humidity with this sensor. I made a circuit following one tutorial and nothing happend, the result was Temperature: 0 Humidity: 0. My question is, what is wrong? Probably the sensor is broken or the code is wrong. I also need to say that i use a 5K1 resistor in exchange of the 4.7K resistor and accidentally I connected the sensor without the resistance for a few seconds.
This is the code:
#include <DHT.h>
#include <DHT_U.h>
int SENSOR = 2;
int TEMPERATURE;
int HUMIDITY;
DHT dht(SENSOR, DHT11);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
TEMPERATURE = dht.readTemperature();
HUMIDITY = dht.readHumidity();
Serial.print("Temperature: ");
Serial.print(TEMPERATURE);
Serial.print(" Humidity: ");
Serial.println(HUMIDITY);
delay(1000);
}
This is the circuit scheme:
This is a photo of the circuit and the sensor (probably damaged):
Thanks for your time and sorry for my bad english.