#include <LiquidCrystal.h>
#include <RTClib.h>
#include <Wire.h>
int button1 = 8;
int button2 = 9;
int counter = 0;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
RTC_DS1307 rtc;
void setup() {
lcd.begin(16,2);
Wire.begin();
rtc.begin();
Serial.begin(9600);
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
}
void loop() {
DateTime Now = rtc.now();
int hour = Now.hour();
int minute = Now.minute();
int second = Now.second();
int push1 = digitalRead(button1);
if (push1 == LOW) {
counter = counter + 1;
delay(500);
}
int push2 = digitalRead(button2);
if (push2 == LOW) {
counter = counter - 1;
delay(500);
}
Serial.println(counter);
lcd.setCursor(0, 0);
lcd.print(hour);
lcd.print(':');
lcd.print(minute + counter);
lcd.print(':');
lcd.print(second);
lcd.setCursor(0,1);
lcd.print("CORRECT MIN:");
lcd.print(counter);
}