ARDUINO UNO + LCD 16x2 + i2c

Have to make HELLO on LCD display



I conect like this

//Тестировалось на Arduino IDE 1.0.5
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);   /* Задаем адрес и размерность дисплея. 
При использовании LCD I2C модуля с дисплеем 20х04 ничего в коде изменять не требуется, cледует только задать правильную размерность */

void setup()
{
  lcd.init();                            // Инициализация lcd             
  lcd.backlight();                       // Включаем подсветку
  // Курсор находится в начале 1 строки
  lcd.print("Hello, world!");            // Выводим текст
  lcd.setCursor(0, 1);                   // Устанавливаем курсор в начало 2 строки
  lcd.print("zelectro.cc");              // Выводим текст
}

void loop()
{
}

I use i2c sceener and find adres 0x3F of my i2c and change

LiquidCrystal_I2C lcd(0x3F,16,2);

But not work.

Help

Did you try adjusting the contrast pot, the square blue thing with the screwdriver slot on the back of the backpack?

Hi,

You need to connect the pins as follow:

//Warning you must connect the Sda to pin A4 and the Clock to pin A5

Try 0x3F instead of 0x27

Hi, Also your are missing in the setup lcd.begin(20, 4);

756E6C:
Did you try adjusting the contrast pot, the square blue thing with the screwdriver slot on the back of the backpack?

Yes I try.

tauro0221:
Hi,

You need to connect the pins as follow:

//Warning you must connect the Sda to pin A4 and the Clock to pin A5

Yes I connect.

[/quote]

noobuinoo:
Try 0x3F instead of 0x27

I changed

[/quote]

tauro0221:
Hi,
Also your are missing in the setup lcd.begin(20, 4);

I’ll try to put lcd.begin(20, 4); in void setup() and try.

//Тестировалось на Arduino IDE 1.0.5
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,16,2);  

void setup()
{
  lcd.begin(20, 4);
  lcd.init();                                         
  lcd.backlight();                       
 
  lcd.print("Hello, world!");           
  lcd.setCursor(0, 1);                   
  lcd.print("zelectro.cc");              
}

void loop()
{
}

LCD screen only blinkne and turn off the backlight.
Does not display any text

I recommend that you use a new library called hd44780. It is available for download with the library manager. The library manager may not be available in the old version (1.0.5) of the IDE you are using. Why not upgrade?

It is auto configuring, and will be “plug and play” compatible with your display. It has help many people in your situation, and its use is now the solution being recommended on the Display section of the forum for people trying to get I2C lcd’s operating.

For your sketch you will use the io class hd44780_I2Cexp.h.

Code: [Select]
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip

void setup()
{
// initialize LCD with number of columns and rows:
lcd.begin(16, 2);

// Print a message to the LCD
lcd.print(“Hello, World!”);
}
void loop() {}

In the examples sketches for the hd44780_I2Cexp class there is a sketch called I2CexpDiag which will show you the exact constructor for your display and test other functionality. You should run that sketch.

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  

void setup()
{
  Serial.begin(9600);
  lcd.begin(16,2);                                     
  lcd.backlight(); 
  lcd.setCursor(0,0);                    
  lcd.print("Hello, Hello");           
  lcd.setCursor(0,1);                   
  lcd.print("I made");              
}

void loop()
{
}

I made. Thenks

Hi, Just in case somebody have the same problem. Did the lcd.begin(16,2) fixed?

Please, sorry but I copy the lcd.begin(20,4) instruction from my sketch and your are was 16x2.

Problem was,

 LikuidCristal_I2C lcd (0k3F, 2, 1, 0, 4, 5, 6, 7, 3, positive);
lcd.begin (16.2);

I only put this LikuidCristal_I2C lcd (0k3F)

And it's not true must be added pins and Positive Must and lcd.begin (16.2)

Thank you

Hi, Thank you for let us know.