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.


O level July 2025 practical Exam question

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:


Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad