DHT11 Not showing correct response (Constant Zero's)

So im very new to Arduino and recently got the Elegoo Mega 2560 R3 The Most Complete Starter Kit,
After a few tests everything worked fine but then i decided to try out the DHT11 Temperature and Humidity Module, After using a tutorial that proved to work in the video. I kept getting the same results of 0.00% Humidity and 0C, I have moved things and changed anything i can and looked into other tutorials. Nothing has worked so ill be posting the schematic and code below to see if possibly i stuffed something up.

/*
#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to
 
dht DHT;
 
void setup(){
 
  Serial.begin(9600);
  delay(500);//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor
 
}//end "setup()"
 
void loop(){
  //Start of Program 
 
    DHT.read11(dht_apin);
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(7000);//Wait 5 seconds before accessing sensor again.
 
  //Fastest should be once every two seconds.
 
}// end loop()
}

Your sketch won't even compile so we know that's not the code that's running on your board. Please post the sketch you're actually using.

There are multiple libraries that contain a file named dht.h. We need to know exactly which library you're using. Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

pert:
Your sketch won't even compile so we know that's not the code that's running on your board. Please post the sketch you're actually using.

The sketch im using compiled fine, heres the sketch again if i accidentally stuffed something up somehow.

#include "dht.h"
#define dht_apin A0 // Analog Pin sensor is connected to
 
dht DHT;
 
void setup(){
 
  Serial.begin(9600);
  delay(500);//Delay to let system boot
  Serial.println("DHT11 Humidity & temperature Sensor\n\n");
  delay(1000);//Wait before accessing Sensor
 
}//end "setup()"
 
void loop(){
  //Start of Program 
 
    DHT.read11(dht_apin);
    
    Serial.print("Current humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature); 
    Serial.println("C  ");
    
    delay(7000);//Wait 5 seconds before accessing sensor again.
 
  //Fastest should be once every two seconds.
 
}// end loop()

pert:
There are multiple libraries that contain a file named dht.h. We need to know exactly which library you're using. Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from. Or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

The library i downloaded from is
https://www.brainy-bits.com/wp-content/uploads/2017/12/DHT_Library.zip

O.k it compiles with that library. But then the code works perfectly for me with a Nano and DHT11. So I’d guess either your wiring is bad (wires sometimes have internal breaks in them) or your DHT11 is dead.

Steve

Estoy probando el sensor dht11

#include "DHT.h"
DHT dht;
void setup()
{
Serial.begin(9600);
Serial.println();
Serial.println("Status\tHumedad (%)\tTemperatura (C)\t(F)");
dht.setup(2); // data pin 2
}
void loop()
{
delay(dht.getMinimumSamplingPeriod());
float humidity = dht.getHumidity();
float temperature = dht.getTemperature();
Serial.print(dht.getStatusString());
Serial.print("\t");
Serial.print(humidity, 1);
Serial.print("\t\t");
Serial.print(temperature, 1);
Serial.print("\t\t");
Serial.println(dht.toFahrenheit(temperature), 1);
}

me marca error de compilacion de la placa

slipstick:
O.k it compiles with that library. But then the code works perfectly for me with a Nano and DHT11. So I'd guess either your wiring is bad (wires sometimes have internal breaks in them) or your DHT11 is dead.

Steve

damn thats the second sensor in this kit that turned out to be broken, The movement sensor in the kit didn't work aswell xD, Well yeah if the code is fine and i know for a fact the wiring is fine then yeah, Must be a broken sensor.