#include <LiquidCrystal_I2C.h> // if you don´t have I2C version of the display, use LiquidCrystal.h library instead
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
//LiquidCrystal_I2C lcd(0x3f,16,2); // set the LCD address to 0x3f for a 16 chars and 2 line display
// if you don´t know the I2C address of the display, use I2C scanner first (https://playground.arduino.cc/Main/I2cScanner/)
int buttonPin = 12;
int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
lcd.init(); // initialize the 16x2 lcd module
lcd.backlight();
// печатаем первую строку
lcd.print("Hello world");
// устанавливаем курсор в колонку 0, строку 1
// на самом деле это вторая строка, т.к. нумерация начинается с нуля
lcd.setCursor(0, 1);
// печатаем вторую строку
lcd.print("rondom");
}
void loop()
{
bool val = digitalRead(buttonPin);
digitalWrite(ledPin, val);
}