###### tags: `Arduino` `Lcd` `I2C`
# Lcd monitor with I2C interface
## intro
Normally, lcd can be connected with Arduino with many wires. With the I2C transfer module, we can use the I2C interface with only 4 wires to connect to your Arduino board.
## code
You can find the library in the built-in Arduino libraries manerger or use the expension library below. But you need to notice the little difference between the defult one and the expension one.
[LiquidCrystal I2C](https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c)

* defult wire pinout:
| GND | Vcc | SDA | SCL |
| -------- | -------- | -------- | --- |
| GND | 5V | **A4** | **A5** |

* defult wire on Mega2560:
| GND | Vcc | SDA | SCL |
| --- | ---- | --- | --- |
| GND | 5V | **A20** | **A21** |
```cpp=
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.clear();
lcd.setCursor(0, 0); //(posision,line)
lcd.print("Hellow World!");
}
void loop(){
}
```
### ref
[【自造學堂】Arduino如何透過I2C控制LCD模組](https://makerpro.cc/2017/02/how-arduino-use-i2c-to-control-lcd-module/)
[【Leon知識領域】LCD I2C 液晶顯示模組](https://leonkf.com/2020/07/04/lcd-i2c/)