I am making a clock on an LCD screen, and I am adding buttons to adjust time. I have four buttons, one for hours up, one for hours down, one for minutes up, a one for minutes down. I do not know what is wrong with it. Here is my code, and a picture of my design. For some reason, my electronic design doesn't show the time. I would just like some help with this, thanks! here is the link to the electronic design. Just click run simulation and click code editor to view the code. here is the code just in case you can't view it. My digital design and code.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int hour = 10; //Must change on each startup to real time
int minutes = 20; //Must change on each startup to real time
int decBtn = 10;
int hrUp = 9;
int hrDwn = 8;
int minUp = 7;
int minDwn = 6;
void setup() {
lcd.begin(16, 2);
pinMode(decBtn, INPUT);
pinMode(hrUp, INPUT);
pinMode(hrDwn, INPUT);
pinMode(minUp, INPUT);
pinMode(minDwn, INPUT);
}
void loop() {
if (digitalRead(hrUp) == HIGH) {
hour = hour + 1;
lcd.clear();
lcd.print(hour);
lcd.print(":");
if (minutes < 10) {
lcd.print(0);
}
lcd.print(minutes);
} else if (digitalRead(hrDwn) == HIGH) {
hour = hour - 1;
lcd.clear();
lcd.print(hour);
lcd.print(":");
if (minutes < 10) {
lcd.print(0);
}
lcd.print(minutes);
} else if (digitalRead(minUp) == HIGH) {
minutes = minutes + 1;
lcd.clear();
lcd.print(hour);
lcd.print(":");
if (minutes < 10) {
lcd.print(0);
}
lcd.print(minutes);
} else if (digitalRead(minDwn) == HIGH) {
minutes = minutes - 1;
lcd.clear();
lcd.print(hour);
lcd.print(":");
if (minutes < 10) {
lcd.print(0);
}
lcd.print(minutes);
delay(10);
lcd.clear();
} else {
if (minutes == 60) {
minutes = 0;
if (hour == 13) {
} else {
hour = hour + 1;
}
}
if (hour == 13) {
hour = 1;
}
lcd.print(hour);
lcd.print(":");
if (minutes < 10) {
lcd.print(0);
}
lcd.print(minutes);
delay(60000);
lcd.clear();
minutes = minutes + 1;
}
}