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
}
Output


Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad