I2C-LCD

:I2C-LCD Screen
The I2C-LCD screen is very suitable for displaying phrases and numbers. It is easy to connect (two wires for power and two wires for data transmission) and works according to the I2C Protocol that converts data from parallel to serial


:Screen Connection
There are specialized ports in Arduino for connecting with I2C-enabled accessories. In Arduino Uno, the clk port must be connected to the port A5.and connect the SDA to port A4. and so with other controllers, we need to know which ports are dedicated to data SDA, and SCL
:Download the library
Many libraries can turn on I2C-LCD screens, but we will explain the most famous library
LiquidCrystal_I2C.h
From programming : Frank de Brabander

A Brief description of the method of connecting accessories according to I2C technology
I2C technology is a widespread technology for connecting various electronic components with electronic controllers. But when you join more than one device to this technology, you must write a different address for each device. In the default case, the screen address is: 0x27
But you can change this address to connect more accessories with i2c technology, you only have to weld the dots behind the screen as shown in the following image

To adjust the brightness - change the pointer behind the screen
You will need a small screwdriver to do this
:Write the code to turn on the screen
In the following code, it displays a phrase in the first row. Then a number (counter) is in the second row. You can modify the code according to the need of your project
Note: You can use the code with a larger screen such as
4Rows * 20 Column. Just change the size in the object definition line
code
#include "Wire.h"
#include "LiquidCrystal_I2C.h"
LiquidCrystal_I2C lcd(0x27,16,2);
// 0x27 is the address
// 16*2 is the size of screen
int x=0;
void setup(){
lcd.init(); // initialize
lcd.backlight();
}
void loop(){
lcd.clear();
lcd.setCursor(1,0); //(C,R)
lcd.print("simple counter");
lcd.setCursor(7,1); //(C,R)
lcd.print(x);
x = x + 1;
delay(1000);
}