Arduino - lcd.clear()
Description
Clears the LCD screen and positions the cursor in the upper-left corner.
Syntax
lcd.clear()
Parameters
- lcd: a variable of type LiquidCrystal
Example
Hardware Required
1 | × | Arduino UNO or Genuino UNO | |
1 | × | USB 2.0 cable type A/B | |
1 | × | LCD | |
1 | × | Potentiometer | |
1 | × | Alternatively, Potentiometer Kit | |
1 | × | Alternatively, Potentiometer Module with Knob | |
1 | × | Breadboard | |
1 | × | Jumper Wires |
Disclosure: Some links in this section are Amazon affiliate links. If you make a purchase through these links, we may earn a commission at no extra cost to you.
Additionally, some links direct to products from our own brand, DIYables .
Additionally, some links direct to products from our own brand, DIYables .
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
}
See Also
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |