PinoutSearch

16x2 LCD Hello World (I²C + Arduino)

Print text on a 16x2 character LCD over I²C with just two data wires. Learn the LiquidCrystal_I2C library.

Beginner20 min

What you need

Wiring

Hover a pin or a wire to trace the connection.

Code

lcd_hello.ino
// Print two lines on a 16x2 I2C LCD.
// Install "LiquidCrystal I2C" (by Frank de Brabander).
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2); // try 0x3F if the screen stays blank

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Hello, world!");
  lcd.setCursor(0, 1);
  lcd.print("PinoutSearch");
}

void loop() {}

Steps

  1. Install "LiquidCrystal I2C" via Library Manager.
  2. Wire: VCC to 5V, GND to GND, SDA to A4, SCL to A5.
  3. Upload. If you see blank boxes, turn the contrast pot on the backpack; if nothing, try address 0x3F.