i am fairly new to arduino and electronics but already have a programming background.
I am trying to get readings from a DHT22 sensor from an Arduino Uno, but all i’ve got is “nan”.
I think that there is something wrong with the sensor i’ve bought as there is a difference in ther pins it has (the pins order)
I’ve bought this sensor
All the sensors i’ve seen online has vcc , data, nc, grd
mine has vcc, grd, sda, scl
I’ve connected 5volts at vcc
ground at grd
and digital pin 7 to sda
I’m trying to get reading using the examples found online to get me started
#define DHTPIN 7 //DHT Digital Pin
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
float temp; //Stores temperature value
//Read data and store it to variables hum and temp
temp = dht.readTemperature();
//Print temp and humidity values to serial monitor
delay(2000); //Delay 2 sec.
Is there a change my sensor ( Brand new ) is broken ?
Is there something wrong with its type? or maybe connectivity?
Any help appreciated