0

Its my first time make arduino project. I make wemos d1 project using DHT11 temperature sensor and LCD 20x4 with i2c. The temperature data will display in LCD and sending to the bot telegram. For sending to the bot telegram it works, but why the data cannot display to the LCD? When I tried common charachter like "Hello World!" in the LCD it works. Can you help me? What should I do? Thanks before.

#include "DHT.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
#define DHTPIN D14  
#define DHTTYPE DHT11   

byte degree[8] = {
  0b00110,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
  0b00000
};

DHT dht(D14, DHT11);

void setup() {
  lcd.createChar(0, degree);
  Serial.begin(115200);
  Serial.println("DHT11 test!");
  lcd.begin (20, 4);
  dht.begin();
}

void loop() {
  delay(2000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  lcd.setCursor(0, 0); 
  lcd.print("Humi : ");
  lcd.print(h); 
  lcd.print(" %");

  lcd.setCursor(0, 1);
  lcd.print("Temp : ");
  lcd.print(t);
  lcd.print(" C");  
}
  • 2
    what you should do is to give us more information. so far, all you have said is that your project does not work. you posted no circuit diagram and no code, so it is impossible to even guess what the problem might be. – jsotola Mar 5 '18 at 3:52
  • 1
    Will you show us your code please, or is it "top secret"? – VE7JRO Mar 5 '18 at 4:10
  • 2
    please add the code to your question and delete these comments ... i do not think that anyone will be able to read your code in comments – jsotola Mar 5 '18 at 5:26
  • 1
    Please define "not working". Does nothing at all get displayed? – Nick Gammon Mar 5 '18 at 6:54
  • 1
    what is D14? Wemos doesn't have pin D14 – Juraj Mar 5 '18 at 8:51
1

Constant D14 is for Wemos D1 and other esp8266 dev boards mapped in arduino core to esp8266 io pin 4. Pin 4 is used as I2C SDA pin. The LCD uses I2C so pin 4 (D14) can't be used for the sensor.

from pins_arduino.h for Wemos D1 R1:

#define PIN_WIRE_SDA (4)
#define PIN_WIRE_SCL (5)

static const uint8_t D14  = 4;
static const uint8_t D15  = 5;

The origin of this confusing esp8266 io pin to Dx constants mapping is the big Wemos D1. There are esp8266 pins mapped to standard Uno pinout.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.