#include<LiquidCrystal.h>
LiquidCrystal LCD(12,11,5,4,3,2);
const int init_time_LSB = 8;
const int init_time_MSB = 1;
void setup()
{
// put your setup code here, to run once:
}
void loop() {
LCD.begin(16,2);
LCD.home();
LCD.setCursor(0,0);
LCD.print(1);
LCD.print(8);
LCD.print(":");
LCD.setCursor(3,0);
LCD.print(4);
LCD.print(3);
LCD.setCursor(5,0);
LCD.print(":");
LCD.print(0);
LCD.print(0);
// put your main code here, to run repeatedly:
for(int i=0;i<=23;i++)
{
for(int j=1;j<=59;j++)
{
for(int k=1;k<=59;k++)
{
LCD.home();
if(k<10)
{
LCD.setCursor(6,0);
LCD.print(0);
LCD.setCursor(7,0);
LCD.print(k);
delay(1000);
}
else
{
LCD.setCursor(6,0);
LCD.print(k);
delay(1000);
}
}
if(j<10)
{
LCD.setCursor(3,0);
LCD.print(0);
LCD.setCursor(4,0);
LCD.print(j);
}
else
{
LCD.setCursor(3,0);
LCD.print(j);
}
}
if(i<10)
{
LCD.setCursor(0,0);
LCD.print(0+init_time_MSB);
LCD.setCursor(1,0);
LCD.print(init_time_LSB+i);
}
else
{
int MSB=i/10;
int LSB=i%10;
LCD.setCursor(0,0);
LCD.print(MSB+init_time_MSB);
LCD.setCursor(1,0);
LCD.print(init_time_LSB+LSB);
}
}
}
Comments