//Тестировалось на 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
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.