User Manual

3/6/2018 I2C LCD2004 - Wiki
http://wiki.sunfounder.cc/index.php?title=I2C_LCD2004 2/5
3) Find the file LiquidCrystal_I2C which you just download. Click it open and then you'll be prompted by "Library added to your libraries. Check 'Import libraries'”. You also can
see the libraries just imported have appeared on the list by Sketch->Include Library->LiquidCrystal_I2C.
Step 3: Copy the code
Copy the follwing code to the Arduino IDE
/*****************************************
* name: I2C LCD2004
* function: You should now see your I2C LCD2004 display "Hello,world!","IIC/I2C LCD2004"
* "20 cols, 4 rows","www.sunfounder.com"
********************************/
//Email:service@sunfounder.com
//Website:www.sunfounder.com
/********************************/
// include the library code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
/*********************************************************/
void setup()
{
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
lcd.setCursor ( 0, 0 ); // go to the top left corner
lcd.print(" Hello,world! "); // write this string on the top row
lcd.setCursor ( 0, 1 ); // go to the 2nd row
lcd.print(" IIC/I2C LCD2004 "); // pad string with spaces for centering
lcd.setCursor ( 0, 2 ); // go to the third row