#include <LiquidCrystal_I2C.h>
// Create an instance of the LCD with I2C address 0x27, 16 columns, and 2 rows
LiquidCrystal_I2C lcd(0x27, 16, 2);
int i;
int j;
void setup() {
lcd.init(); // Initialize the LCD
lcd.clear(); // Clear the LCD screen
lcd.backlight(); // Turn on the backlight
i = 15; // Initialize i to 15 to start from the rightmost position
j = 0; // Initialize j to 0 (first row)
Serial.begin(9600); // Start serial communication at 9600 baud rate
}
void loop() {
lcd.setCursor(i, j); // Set cursor to the position (i, j)
lcd.print("hey mithin"); // Print the message
Serial.println("welcome!"); // Print to serial monitor
i--; // Move cursor position to the left
delay(500); // Wait for 500 milliseconds
if (i < 0) { // If cursor goes beyond the left side
i = 15; // Reset to the rightmost position
}
}