Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ARDUINO LCD CLOCK
- //24:00 hours format
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27,16,2);
- int ss = 0; //seconds
- int mm = 40; //minutes, set the time of your area where you live
- int hh = 19; //hours, this time is only an example.
- void setup() {
- lcd.init();
- lcd.init();
- lcd.backlight();
- lcd.begin(16, 2);
- }
- void loop() {
- for (ss = 0; ss < 60; ss++) {
- lcd.clear();
- lcd.setCursor(3, 0);
- lcd.print("Hrs");
- lcd.setCursor(4, 1);
- lcd.print(hh);
- lcd.setCursor(6, 1);
- lcd.print(":");
- lcd.setCursor(7, 0);
- lcd.print("Min");
- lcd.setCursor(7, 1);
- lcd.print(mm);
- lcd.setCursor(9, 1);
- lcd.print(":");
- lcd.setCursor(11, 0);
- lcd.print("Sec");
- lcd.setCursor(10, 1);
- lcd.print(ss);
- delay(1000);
- }
- if(ss > 59) {
- ss = 00;
- mm = mm+1;}
- if(mm > 59){
- mm = 00;
- hh = hh+1;}
- if(hh == 24){
- hh = 00;
- mm = 00;
- ss = 00;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement