Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views7 pages

Arduino Libraries

The Liquid Crystal Library provides functions to control LCD displays using Arduino, allowing for configuration with 4 or 8 data lines. Key functions include initializing the display, clearing the screen, setting the cursor position, and printing text. Additional features include cursor visibility, display scrolling, and creating custom characters.

Uploaded by

Dhruv Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

Arduino Libraries

The Liquid Crystal Library provides functions to control LCD displays using Arduino, allowing for configuration with 4 or 8 data lines. Key functions include initializing the display, clearing the screen, setting the cursor position, and printing text. Additional features include cursor visibility, display scrolling, and creating custom characters.

Uploaded by

Dhruv Agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Liquid Crystal Library

Functions
• LiquidCrystal()

Creates a variable of type LiquidCrystal. The display can be controlled using 4 or 8 data
lines. If the former, omit the pin numbers for d0 to d3 and leave those lines unconnected. The RW pin
can be tied to ground instead of connected to a pin on the Arduino; if so, omit it from this function's
parameters.
Syntax
LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystal(rs, enable, d0, d1, d2, d3, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)
Parameters
rs: the number of the Arduino pin that is connected to the RS pin on the LCD
rw: the number of the Arduino pin that is connected to the RW pin on the LCD (optional)
enable: the number of the Arduino pin that is connected to the enable pin on the LCD
d0, d1, d2, d3, d4, d5, d6, d7: the numbers of the Arduino pins that are connected to the
corresponding data pins on
the LCD. d0, d1, d2, and d3 are optional; if omitted, the LCD will be controlled using
only the four data lines (d4, d5, d6, d7).
• begin()
Syntax • Parameters
lcd.begin(cols, lcd: a variable of type LiquidCrystal
rows) cols: the number of columns that the
display has
rows: the number of rows that the display
• clear() has
Syntax
lcd.clear() • Parameters
lcd: a variable of type LiquidCrystal
• home()
Syntax
begin() : Initializes the interface to the LCD• screen,and
lcd.home() Parameters specifies the
dimensions(width and height) lcd: a variable of type LiquidCrystal
of the display. begin() needs to be called before any other LCD library
commands.

clear() : Clears the LCD screen and positions the cursor in the upper-left corner.

home() : Positions the cursor in the upper-left of the LCD. That is, use that
location in outputting
subsequent text to the display. To also clear the display, use the
• setCursor()
Syntax • Parameters
lcd.setCursor(col, row) lcd: a variable of type LiquidCrystal
col: the column at which to position the cursor (with 0
being the first column)
row: the row at which to position the cursor (with 0
being the first row)

• write()
Syntax • Parameters

lcd.write(data) lcd: a variable of type LiquidCrystal

• cursor() data: the character to write to the display

Syntax • Parameters

lcd.cursor() lcd: a variable of type LiquidCrystal


setCursor() : Position the LCD cursor; that is, set the location at which
subsequent text written to the LCD will be displayed.
write() : Write a character to the LCD.
cursor() : Display the LCD cursor: an underscore (line) at the position to which
the next character will be written.
• noCursor()
Syntax
• Parameters
lcd.noCursor()
lcd: a variable of type LiquidCrystal
• print()
Syntax
lcd.print(data) • Parameters
lcd.print(data, BASE) • lcd: a variable of type LiquidCrystal
Returns
• data: the data to print (char, byte, int,
byte long, or string)
print() will return the number of bytes
written, though reading that number is • BASE (optional): the base in which to
optional print numbers: BIN for binary (base 2),
DEC for decimal (base 10), OCT for
octal (base 8), HEX for hexadecimal
(base 16).

noCursor : Hides the LCD cursor.


print() : Prints text to the LCD.
• blink() • Parameters
Syntax lcd: variable of type Liquid Crystal
lcd.blink()
• noBlink()
• Parameters
Syntax
lcd: a variable of type LiquidCrystal
lcd.noBlink()
• display()
• Parameters
Syntax
lcd: a variable of type LiquidCrystal
lcd.display()
• noDisplay()
Syntax • Parameters
lcd.noDisplay() • lcd: a variable of type LiquidCrystal

blink() : Display the blinking LCD cursor. If used in combination with the cursor()
function, the result will depend on the particular display
noBlink() : Turns off the blinking LCD cursor.
display() : Turns on the LCD display, after it's been turned off with noDisplay
(). This will restore the text (and cursor) that was on the display.
noDisplay() : Turns off the LCD display, without losing the text currently shown on it.
• scrollDisplayLeft() • Parameters
Syntax lcd: a variable of type LiquidCrystal
lcd.scrollDisplayLeft()
• scrollDisplayRight()
Syntax
• Parameters
lcd.scrollDisplayRight() lcd: a variable of type LiquidCrystal
• leftToRight()
Syntax • Parameters
lcd.leftToRight() lcd: a variable of type LiquidCrystal
• rightToLeft()
Syntax • Parameters
lcd.rightToLeft() lcd: a variable of type LiquidCrystal

scrollDisplayLeft() : Scrolls the contents of the display (text and cursor) one space to the left.
scrollDisplayRight() : Scrolls the contents of the display (text and cursor) one space to the
right.
leftToRight() : Set the direction for text written to the LCD to left-to-right, the default. This
means that subsequent characters written to the display will go from left to right, but does
not affect previously-output text.
rightToLeft() : Set the direction for text written to the LCD to right-to-left (the default is left-
to-right). This means that subsequent characters written to the display will go from right to
left, but does not affect previously-output text.
• autoscroll() • Parameters
Syntax lcd : a variable of type LiquidCrystal
lcd.autoscroll()
• noAutoscroll()
• Parameters
Syntax
lcd : a variable of type LiquidCrystal
lcd.noAutoscroll()
• createChar()
• Parameters
Syntax
lcd: a variable of type LiquidCrystal
lcd.createChar(num,data)
num: which character to create (0 to 7)
data: the character's pixel data

autoscroll() :Turns on automatic scrolling of the LCD. This causes each character output to the display to
push previous characters over by one space. If the current text direction is left-to-right (the default), the
display scrolls to the left; if the current direction is right-to-left, the display scrolls to the right. This has the
effect of outputting each new character to the same location on the LCD.
noAutoscroll() : Turns off automatic scrolling of the LCD.
createChar() : Create a custom character (glyph) for use on the LCD. Up to eight characters of 5x8 pixels
are supported (numbered 0 to 7). The appearance of each custom character is specified by an array of
eight bytes, one for each row. The five least significant bits of each byte determine the pixels in that row.
To display a custom character on the screen, write() its number.
NB : When referencing custom character "0", if it is not in a variable, you need to cast it as a byte,
otherwise the compiler throws an error.

You might also like