So I've copied a lot of different example codes for this sensor, as well as downloading library after library. I can't get the sensor to read anything other than zero. I've changed the pin to a couple different locations and have made sure to change it in the codes as well.. am I missing something?
currently i moved from the pwm pins to pin 24 since it's just digital with this code now and it still not working . . any help would be greatly appreciated sorry for no photos
#include <dht.h>
dht DHT;
#define DHT11_PIN 24
void setup(){
Serial.begin(9600);
}
void loop(){
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
delay(1000);
}
I simulated the code in Wokwi, but it does not have DHT11, only DHT22.
It worked correctly.
Review your connections or replace your sensor with a new one.
I'll try getting a new sensor, thankyou!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.