Creating my own Very Simple Alamr Clock with Arduino, DS1307, & LCD Module

Hello. I would like to ask for your help and guidance. We have a project, and we are tasked to create an alarm clock.

I would like to start with this very easy question since I can hardly understand it. (I Google’d the code below)

/*
 Code under (cc) by Manuel Gonzalez, www.codingcolor.com
 http://creativecommons.org/license/cc-gpl
 Pins 12, 11, 5, 4, 3, 2 to LCD
 Analog pins 4 (SDA),5(SCL) to Chronodot
 Pins 6 (hour), 7(min) buttons
*/

#include <Wire.h>
#include <LiquidCrystal.h>


const int hourButtonPin = 6;
const int minButtonPin = 7;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int hourButtonState;
int minButtonState;
int settingAlarm; //press to toggle from alarm mode to display mode, VV.

int seconds; //00-59;
int minutes; //00-59;
int hours;//1-12 - 00-23;
int day;//1-7
int date;//01-31
int month;//01-12
int year;//0-99;




void setup()
{

  pinMode(hourButtonPin,INPUT);
  pinMode(minButtonPin,INPUT);
  pinMode(alarmSetPin,INPUT);

  Wire.begin();
  lcd.begin(16, 2);
 
  hourButtonState = 0;
  minButtonState = 0;
  ////////////////////////////////
  seconds = 00;
  minutes = 28;
  hours = 19;
  day = 7;
  date = 18;
  month = 12;
  year = 13;
  //initChrono();//just set the time once on your RTC
  ///////////////////////////////
}

void get_alarm()
{
  
}
void loop()
{
  check_buttons();
  get_time();
  get_date();
  display_time();
  display_date();
  delay(1000);
 
}
void display_time()
{
  char buf[12];
 
  lcd.setCursor(0, 0);
 
  if(hours == 0)
  {
    lcd.clear();
  }
 
  lcd.print("Time ");  
  lcd.print(itoa(hours, buf, 10));
  lcd.print(":");
 
  if(minutes < 10)
  {
    lcd.print("0");
  }
  lcd.print(itoa(minutes, buf, 10));
 
  lcd.print(":");
 
  if(seconds < 10){
    lcd.print("0");
  }
  lcd.print(itoa(seconds, buf, 10));

}
void display_date()
{
  char buf[12];
 
  lcd.setCursor(0, 1);
  lcd.print("Date ");
 
 if(month < 10){
    lcd.print("0");
  }  
 
  lcd.print(itoa(month, buf, 10));
  lcd.print("/");
  lcd.print(itoa(date, buf, 10));
  lcd.print("/");
 
  if(year < 10){
    lcd.print("0");
  }
 
  lcd.print(itoa(year, buf, 10));
}
void initChrono()
{
  set_time();
  set_date();
}


void set_date()
{
  Wire.beginTransmission(104);
  Wire.write(3);
  Wire.write(decToBcd(day));
  Wire.write(decToBcd(date));
  Wire.write(decToBcd(month));
  Wire.write(decToBcd(year));
  Wire.endTransmission();
}
void get_date()
{
  Wire.beginTransmission(104);
  Wire.write(3);//set register to 3 (day)
  Wire.endTransmission();
  Wire.requestFrom(104, 4); //get 5 bytes(day,date,month,year,control);
  day   = bcdToDec(Wire.read());
  date  = bcdToDec(Wire.read());
  month = bcdToDec(Wire.read());
  year  = bcdToDec(Wire.read());
}

void set_time()
{
   Wire.beginTransmission(104);
   Wire.write(0);
   Wire.write(decToBcd(seconds));
   Wire.write(decToBcd(minutes));
   Wire.write(decToBcd(hours));
   Wire.endTransmission();
}
void get_time()
{
  Wire.beginTransmission(104);
  Wire.write(0);//set register to 0
  Wire.endTransmission();
  Wire.requestFrom(104, 3);//get 3 bytes (seconds,minutes,hours);
  seconds = bcdToDec(Wire.read() & 0x7f);
  minutes = bcdToDec(Wire.read());
  hours = bcdToDec(Wire.read() & 0x3f);
 
 


 
}
void setHour()
{
  hours++;
  if(hours > 23)
  {
   hours = 0;
   seconds = 0;
   minutes = 0;
  }
  set_time();
 
}
void setMinutes()
{
  minutes++;  
  if(minutes > 59)
  {
   minutes = 0;
   
  }
  seconds=0;
 
  set_time();
 
}
void check_buttons()
{
  hourButtonState = digitalRead(hourButtonPin);
  minButtonState = digitalRead(minButtonPin);
 
  if(hourButtonState == HIGH){
    setHour();
  }
 
  if(minButtonState == HIGH){
    setMinutes();
  }
}
///////////////////////////////////////////////////////////////////////

byte decToBcd(byte val)
{
  return ( (val/10*16) + (val%10) );
}

byte bcdToDec(byte val)
{
  return ( (val/16*10) + (val%16) );
}
//////////////////////////////////////////////////////////////////////

So basically, my question is, what’s the purpose of hourButtonState? I already have my connection and I don’t see any connection in pin 6 and 7.

But based on my understanding, when that pin is shorted (button was pressed), the current time displayed on LCD increases by 1? Am I correct?

I am searching for the code for this project and I am very unfortunate to find one. I really need to finish this ASAP since this is just 1/3 of the whole project.

So basically, my question is, what's the purpose of hourButtonState? I already have my connection and I don't see any connection in pin 6 and 7.

The question and the following statement are completely unrelated. I can't imagine why you are declaring hourButtonPin and minButtonPin if there is nothing attached to the pins that the value indicates.

It would appear that hourButtonState is meant to hold the state read from the hourButtonPin. But, if there is no switch attached to the hourButtonPin, then hourButtonState is a useless variable, and you can delete it.