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.

Code :-
 

#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

Popular Posts

What is Tinkercad ? How to use Tinkercad ?

Connect switch to Arduino. If switch is on than print ”ON” else print “OFF” on serial monitor.

Set the time using four switch and display the clock on LCD using arduino ** SW1 : when press, increment 1 digit ** SW2 : when press, decrement 1 digit ** SW3 : when press, display set time and start the clock ** SW4 : when press, reset the clock