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

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

Identify bugs and resolve it to fulfill following objective. Interface 3 LEDs and 4 SWICHES with Arduino. Develop a program that by pressing 1st switch it will ON LED1, by pressing 2nd switch it ON LED2 and same for 3rd switch and LED3. By pressing 4th switch it will reset (OFF) all LEDs.

What is Tinkercad ? How to use Tinkercad ?