LCD code not working pls help

So i bought from China a set of usefull devices that work with arduino and inside i found a DHT11 temperature and something else Humidity sensor and a lcd .
The first idea i had was a mobile arduino based termometre so i looked on the interned for codes and i found two that can help me :

I combined them and when i pluged the lcd and the sensor in the lcd just light up and didn’t show anything pls help
I use a uno ,i have the exact lcd like the guy where i got the code and connected exactly like in the post
Sorry for any speeling problems i am not a native speaker :).
BTW the code that i created:

/*
** Example Arduino sketch for SainSmart I2C LCD Screen 16x2
** based on https://bitbucket.org/celem/sainsmart-i2c-lcd/src/3adf8e0d2443/sainlcdtest.ino
** by
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)

** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** https://bitbucket.org/fmalpartida/new-liquidcrystal

** Modified - Ian Brennan ianbren at hotmail.com 23-10-2012 to support Tutorial posted to Arduino.cc

** Written for and tested with Arduino 1.0
**
** NOTE: Tested on Arduino Uno whose I2C pins are A4==SDA, A5==SCL

*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include<dht.h>
dht DHT;
#define I2C_ADDR    0x3F // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7
#define DHT11_PIN 5
int n = 1;

LiquidCrystal_I2C  lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin);

void setup()
{
  lcd.begin (16, 2); //  <<----- My LCD was 16x2


  // Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
  lcd.setBacklight(HIGH);
  lcd.home (); // go home

  lcd.print("SainSmartI2C16x2");
}

void loop()
{
  int chk = DHT.read11(DHT11_PIN);
  lcd.println(" Humidity " );

  lcd.println(DHT.humidity, 1);

  lcd.println(" Temparature ");

  lcd.println(DHT.temperature, 1);

  delay(2000);

}

Did you run the I2C scanner and make sure you have the right address for your LCD?

Andreiva:
i have the exact lcd like the guy where i got the code and connected exactly like in the post

Probably not. While you may have a similar LCD, the backpack is probably not exactly the same as the one the example code was using.
When using that library, you must have the correct parameters in your constructor for the exact backpack you are using (not all lcd backpacks are the same)
The i2c address and the pin mapping parameters must be correct.
If not, it won’t work.
It could be that the i2c address or the pin mappings used on the backpack on your LCD is different.

I would recommend using my hd44780 library package.
It will automatically self configure itself for the correct i2c address and pin mapping parameters.
It can be installed directly from the IDE GUI using the IDE library manager.
You can search around on the forum as I’ve posted many times about it.
You can also read more about it on the github page:GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
And the wiki.

The i/o class you will want to use is hd44780_I2Cexp
First run the included I2CexpDiag sketch to make sure the library and h/w are working correctly.
See the included hd44780_I2Cexp examples like the HelloWorld for a minimal example on how to use the library.
The only differences from fm’s New LiquidCrystal library will be the files included and the constructor.

— bill

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Including pin numbers and component labels, so we can see how your project is wired.
(PLEASE do not use fritzy image)

Thanks… Tom… :slight_smile:

NVM i was the contrast setting

bperrybap:
Probably not. While you may have a similar LCD, the backpack is probably not exactly the same as the one the example code was using.
When using that library, you must have the correct parameters in your constructor for the exact backpack you are using (not all lcd backpacks are the same)
The i2c address and the pin mapping parameters must be correct.
If not, it won't work.
It could be that the i2c address or the pin mappings used on the backpack on your LCD is different.

I would recommend using my hd44780 library package.
It will automatically self configure itself for the correct i2c address and pin mapping parameters.
It can be installed directly from the IDE GUI using the IDE library manager.
You can search around on the forum as I've posted many times about it.
You can also read more about it on the github page:GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
And the wiki.

The i/o class you will want to use is hd44780_I2Cexp
First run the included I2CexpDiag sketch to make sure the library and h/w are working correctly.
See the included hd44780_I2Cexp examples like the HelloWorld for a minimal example on how to use the library.
The only differences from fm's New LiquidCrystal library will be the files included and the constructor.

--- bill

I run the test and i had the exactly the same controler on the back

Andreiva:
I run the test and i had the exactly the same controler on the back

I do not understand what you are trying to say.
Can you explain further.