Example Code for Arduino-Hello World Display
Last revision 2026/01/17
This article offers a detailed tutorial on using an Arduino LCD display to show 'Hello World', covering hardware requirements like the DFR0063 I2C 16x2 LCD module and Arduino UNO or Leonardo, software needs including Arduino IDE and LiquidCrystal_I2C library, and providing a wiring diagram for connection setup. The sample code initializes the LCD and prints 'Hello, world!' with backlight enabled, and additional tips ensure successful display. Perfect for beginners, it highlights the importance of setting the correct I2C address and library installation, making it easy to follow and execute for those new to Arduino projects.
Hardware Preparation
- DFR0063 I2C 16x2 Arduino LCD Display Module: 1, Purchase Link
- Arduino UNO: 1, Purchase Link (or Arduino Leonardo: 1, Purchase Link)
Software Preparation
- Arduino IDE 1.0 or later: Download Link
- LiquidCrystal_I2C library: Download Sample code and library
Wiring Diagram
The wiring diagram for connecting the module to Arduino is as follows:
"
Connection instructions:
- Arduino UNO: connect SDA to pin A4 and SCL to pin A5 on your Arduino.
- Arduino Leonardo: connect SDA to digital pin 2 and SCL to digital pin 3 on your Arduino.
Other Preparation Work
- Ensure the LCD module's I2C address is set to 0x20 (all jumper caps are connected by default).
- Install the LiquidCrystal_I2C library in the Arduino IDE: download the library zip file, open Arduino IDE, go to Sketch > Include Library > Add .ZIP Library, and select the downloaded file.
- Note: V1.2 has a different power pinout from V1.1, please check the history version for the old connection diagram.
Sample Code
//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x20,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("Hello, world!");
}
void loop()
{
}
Result
The LCD module will display "Hello, world!" and the backlight will be turned on.
Additional Information
If you want to use the library's own sample code, pay attention to modify the initialization statement: change LiquidCrystal_I2C lcd(0x27,16,2); to LiquidCrystal_I2C lcd(0x20,16,2); (all jumpers should be connected!).
Was this article helpful?
