Reference

Library

Download Sample code and library.

The library supports the following functions:

  • LiquidCrystal_I2C() //set the LCD address for a 16 chars and 2 line display
  • init() //Initialization for the LCD
  • clear() //clear display, set cursor position to zero
  • home() //set cursor position to zero
  • createChar() //Fill the first 8 CGRAM locations with custom characters
  • setCursor() //set the position of the cursor
  • cursor() //Turns the underline cursor on
  • noCursor() //Turns the underline cursor off
  • blink() //Turn on the blinking cursor
  • noBlink() //Turn off the blinking cursor
  • display() //Turn the display on(quickly)
  • noDisplay() //Turn the display off(quickly)
  • backlight() //Turn the backlight on
  • noBacklight() //Turn the backlight off
  • scrollDisplayLeft() //Make the display scroll left without changing the RAM
  • scrollDisplayRight() //Make the display scroll right without changing the RAM
  • autoscroll() //This will 'right justify' text from the cursor
  • noAutoscroll() //This will 'left justify' text from the cursor
  • leftToRight() //This is for text that flows Left to Right
  • rightToLeft() //This is for text that flows Right to Left

Communication Protocol Description

The module uses I2C (Inter-Integrated Circuit) communication protocol. Key parameters:

  • I2C Address range: 0x20-0x27 (default: 0x20)
  • Interface: I2C/TWI x1, Gadgeteer interface x2
  • Supply voltage: 5V

API Description

The library provides the following functions for controlling the LCD module:

  • LiquidCrystal_I2C(): Set the LCD address for a 16 chars and 2 line display.
  • init(): Initialize the LCD.
  • clear(): Clear the display and set the cursor position to zero.
  • home(): Set the cursor position to zero.
  • createChar(): Fill the first 8 CGRAM locations with custom characters.
  • setCursor(): Set the position of the cursor.
  • cursor(): Turn on the underline cursor.
  • noCursor(): Turn off the underline cursor.
  • blink(): Turn on the blinking cursor.
  • noBlink(): Turn off the blinking cursor.
  • display(): Turn the display on quickly.
  • noDisplay(): Turn the display off quickly.
  • backlight(): Turn the backlight on.
  • noBacklight(): Turn the backlight off.
  • scrollDisplayLeft(): Make the display scroll left without changing the RAM.
  • scrollDisplayRight(): Make the display scroll right without changing the RAM.
  • autoscroll(): Right justify text from the cursor.
  • noAutoscroll(): Left justify text from the cursor.
  • leftToRight(): Set text flow from left to right.
  • rightToLeft(): Set text flow from right to left.

Contrast Adjust

The contrast can be adjusted by the potentiometer displayed in the following picture:

9c344548422c2f02ff5f01a79f4d92f5.jpg

Address Setting

The I2C address of the module can be set by the jumper caps. The address is determined by the A2, A1, and A0 pins:

A2 A1 A0 IIC Address
0 0 0 0x20
0 0 1 0x21
0 1 0 0x22
0 1 1 0x23
1 0 0 0x24
1 0 1 0x25
1 1 0 0x26
1 1 1 0x27
  • 0: The Jumper Cap is connected.
  • 1: The Jumper Cap is disconnected.

The default address is 0x20. All the jumper caps will be connected from the factory.

Old Version and Projects

Power Pinout Note

V1.2 has a different power pinout from V1.1, please check the history version for the old connection diagram.

Was this article helpful?

TOP