#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);//rs12, e 11, 2 -d4,3 -d5 4-,d6,5-d7
int sec_=0,min_=0,hour_=0;
long x;
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.print("Digital Clock");
x=millis();
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 3);
// print the number of seconds since reset:
if (millis()>(x+1000)){
x=millis();
if (sec_<60){
sec_++;
}
else{
sec_=0;
if (min_<60){
min_++;
}
else{
min_=0;
if (hour_<24){
hour_++;
}
else{
hour_=0;
}
}
}
}
lcd.print(sec_);
lcd.print(" sec");
lcd.setCursor(0, 2);
// print the number of seconds since reset:
lcd.print(min_);
lcd.print(" min");
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(hour_);
lcd.print(" hours");
}