Programming Examples
Write a program to print “Hello World!” to the LCD (Liquid Crystal Display) and shows the time in seconds since the Arduino was reset.

Write a program to print “Hello World!” to the LCD (Liquid Crystal Display) and shows the time in seconds since the Arduino was reset.
Solution#include <LiquidCrystal.h>
// RS, E, D4, D5, D6, D7 pins of LCD connected to Arduino
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2); // Initialize 16x2 LCD
lcd.print("Hello World!");
}
void loop() {
lcd.setCursor(0, 1); // Move cursor to second row
lcd.print("Time: ");
lcd.print(millis() / 1000); // Time in seconds
lcd.print(" sec");
delay(1000); // Update every second
}
▶ RUN Output/ Explanation: 