Arduino - lcd.home()
Description
Positions the cursor in the upper-left corner (0, 0) of the LCD. That is, use that location in outputting subsequent text to the display. To also clear the display, use the lcd.clear() function instead.
The below image shows LCD coordinate.
Syntax
lcd.home()
Parameters
- lcd: a variable of type LiquidCrystal
Example
Hardware Required
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.
Wiring Diagram
This image is created using Fritzing. Click to enlarge image
Arduino Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(11, 12, 2, 3, 4, 5);
void setup()
{
lcd.begin(16, 2); // set up the LCD 16x2
}
void loop()
{
lcd.print("hello, world!");
delay(1000); // keep the text on LCD 1 second
lcd.clear();
delay(1000); // keep LCD empty in 1 second
lcd.home(); // move the cursor to the upper-left corner of the LCD
}
※ NOTES AND WARNINGS:
lcd.home() is equivalent to lcd.setCursor(0, 0). See lcd.setCursor().
See Also
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |