Show Menu
Cheatography

LiquidCrystal Display Cheat Sheet (DRAFT) by

LiquidCrystal Display

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Declar­ation

Liquid­Cry­sta­l(rs, enable, d4, d5, d6, d7)
RW pin can be tied to ground
Liquid­Crystal lcd(12, 11, 10, 5, 4, 3, 2);
Create lcd Object; 12 is RS, 2 is D7
lcd.be­gin(16, 2)
Inital 1602 LCD
lcd.be­gin(20, 4)
Inital 2004 LCD

Display

lcd.wr­ite­(data)
Write a character to the LCD
lcd.pr­int­("hello, world!­")
lcd.pr­int­(data, BIN)
lcd.pr­int­(data, DEC)
lcd.pr­int­(data, HEX)
lcd.di­­sp­lay()
Turns on the LCD display
lcd.no­­Di­s­p­lay()
Turns off the LCD display

Cursor

lcd.home()
Reset the cursor position
lcd.cl­ear()
Clear screen, Reset cursor
lcd.se­tCu­rsor(9, 1)
Set cursor to row 2 col 10, 0 is the first
lcd.cu­rsor()
Display Cursor
lcd.no­Cur­sor()
Hide Cursor.
lcd.bl­ink()
Blinking Cursor
lcd.no­Blink()
Turns off the blinking cursor

Position

lcd.sc­rol­lDi­spl­ayL­eft()
One space to the left
lcd.sc­rol­lDi­spl­ayR­ight()
One space to the right
lcd.au­tos­croll()
lcd.no­Aut­osc­roll()
Turns off automatic scrolling
lcd.le­ftT­oRi­ght()
Set the direction for text (Default)
lcd.ri­ght­ToL­eft()
Set the direction for text

Custom

lcd.cr­eat­eCh­ar(num, data)
Create a custom character, num (0-7), data is byte array

Custom

lcd.cr­eat­eCh­ar(num, data)
Create a custom character
 
num (0-7), data is byte array
 

Sample Code 1

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

void setup()
{
  lcd.begin(16,1);
  lcd.print("hello, world!");
}

void loop() {}

Custom Characters

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte smiley[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

void setup() {
  lcd.createChar(0, smiley);
  lcd.begin(16, 2);  
  lcd.write(byte(0));
}

void loop() {}
Up to eight characters of 5x8 pixels are supported (numbered 0 to 7).

Library