#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the I2C address and LCD dimensions
const String upperRowText = "oM zrii gurave namaH , I am learning Arduino.";
const String bottomRowText = "-\\^|^/- = som";
void setup() {
lcd.begin(16, 2); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0); // Set the cursor to the beginning
}
void loop() {
scrollUpperRow(); // Call the function to scroll text on the upper row
flashBottomRow(); // Call the function to flash text on the bottom row
}
void scrollUpperRow() {
static int scrollIndex = 0;
static int textLength = upperRowText.length();
lcd.clear(); // Clear the LCD
// Display 16 characters at a time on the upper row
lcd.setCursor(0, 0);
lcd.print(upperRowText.substring(scrollIndex, scrollIndex + 16));
delay(100); // Adjust the delay for smooth scrolling
scrollIndex = (scrollIndex + 1) % (textLength + 16); // Update the scroll index
}
void flashBottomRow() {
lcd.setCursor(0, 1); // Set the cursor to the beginning of the bottom row
lcd.print(bottomRowText);
delay(200); // Interval for flashing text
lcd.clear(); // Clear the bottom row
delay(100); // Interval for a blank display
}