Write program to show clock on LCD as follows for Arduino.
Here i am using online IDE Tinkercad . If you don't know what is tinkercad then refer my blog HERE or else you can use offline IDE also.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
lcd.begin(16, 2);
}
void loop()
{
for(int h=0;h<24;h++)
{
lcd.setCursor(5,0);
lcd.print("TIME");
lcd.setCursor(3,1);
if(h<10)
lcd.print("0");
lcd.print(h);
lcd.print(":");
for(int m=0;m<60;m++)
{
lcd.setCursor(6,1);
if(m<10)
lcd.print("0");
lcd.print(m);
lcd.print(":");
for(int s=0;s<60;s++)
{
lcd.setCursor(9,1);
if(s<10)
lcd.print("0");
lcd.print(s);
delay(1000);
}
}
}
}
Output :-
Comments
Post a Comment