So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By ayu
#61351 Hi there,

I struggled the whole morning against the DHT11 Sensor until I gave up and decided to ask somebody more clever then me - you.

I have this sensor:
http://www.miniinthebox.com/de/temperatur-feuchte-sensor-dht11-modul-fuer-arduino-deep-blue-arbeiten-mit-amts-arduino-board_p1141519.html?litb_from=crm_payment_shipped&user_email=ayu4ger%40gmail.com&mname=de_sys_M20161101_1_0&content=0&p_id=0&c_id=0&send_date=2016110118&merchant=7&customer_id=8132279&customer_token=9b63a5fb2bdda765&utm_source=de-sysmail&utm_medium=newsletter&utm_campaign=MITB20161101

and a Wemos D1 mini board.

...And here comes the problem, the sensor works fine with my Arduino Mega, but when I try to achieve the same thing on the Wemos, absolutely nothing happens. I use the following code:

Code: Select all#include "DHT.h"
#define DHTPIN 1 
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE, 15); //DHT11 - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: DHT dht(DHTPIN, DHTTYPE, 15);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h)) {
  Serial.println("Failed to read from DHT");
  Serial.println(h);
  Serial.println(t);
  }
else {
  Serial.println("Temp=");
  Serial.println(t);
  Serial.println(" *C");
  Serial.println("Humidity=");
  Serial.println(h);
  Serial.println("% ");

 }
   delay(2000);
}


Any help is appreciated :)

ayu