#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7); // initialize the library with the numbers of the interface pins
void setup() {
lcd.begin(16, 2); // // Initializing the LCD by setting up the LCD's number of columns and rows
lcd.clear(); // clear the LCD screen
}
void loop() {
// Condition 1: Same length Words overrides.
lcd.setCursor(4, 0); // set the cursor position to column 4, row 0 (counting starts from 0)
lcd.print("Welcome"); // print the word "Hello" at the cursor position
lcd.setCursor(4, 0); // set the cursor position to column 4, row 0 (counting starts from 0)
lcd.print("Friends"); // print the word "Hello" at the cursor position
delay(5000);
lcd.clear(); // clear the LCD screen at the beginning of each loop iteration
delay(500);
// Condition 2: Words overrides upto the length of specific word.
lcd.setCursor(3, 1); // set the cursor position to column 3, row 1 (counting starts from 0)
lcd.print("Welcome"); // print the word "Hello" at the cursor position
lcd.setCursor(3, 1); // set the cursor position to column 3, row 1 (counting starts from 0)
lcd.print("Hello"); // print the word "Hello" at the cursor position
delay(6000);
lcd.clear(); // clear the LCD screen at the beginning of each loop iteration
delay(1000);
}