Hello guys,
I am trying to use a DHT11 temperature and humidity sensor with Stalker 2.3v, but with no success.
What is strange is that I just used the DHT11 sensor in my arduino UNO and it worked well. Then, when I connected the DHT11 sensor in my Seeeduino Stalker v2.3 using the same pins, I cannot get the temperature and humidity.
The arduino code is the following:
#include "DHT.h"
#define DHTPIN A0
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600);
Serial.println("DHTxx test!");
dht.begin();
}
void loop()
{
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h))
{
Serial.println("Failed to read from DHT");
}
else
{
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
}
It returns temperature and humidity = 0.
The pin 1 of the DHT11 sensor is connected in the 5V, pin 2 in the A0 and pin 4 in the GND os the Stalker.
Why is this working in my arduino UNO and not working in my Seeduino Stalker v2.3?
Thank you!