Time setting pushbutton

PART 1/2

hi,

i was going through this project 404 - 页面不存在
and im wondering if there is any chance of adding push button for user to adjust the time rather than connecting to the PC.

i found the below on some search in google.

//manual time adjustment away from serial update
int modePin = 13;
int plusMin = 1;
int plusHr = 6;
int minusMin = 7;
int minusHr = 8;

//sets switches value to off as default
int mode = 0;
int minPlus = 0;
int minMinus = 0;
int hrPlus = 0;
int hrMinus = 0;

void loop()
{
  
  SetTimeManual();
  serialClockDisplay();
  PhysicalDisplay();
  delay(200);
}

void SetTimeManual() {
  mode = digitalRead(modePin); //gets state of mode pin that locks to clock or set time
  minPlus = digitalRead(plusMin);
  minMinus = digitalRead(minusMin);
  hrPlus = digitalRead(plusHr);
  hrMinus = digitalRead(minusHr);
  
  if (mode == HIGH)
  {
    
    if(Serial.available())
    {
      setSyncProvider(RTC.get);
      time_t t = processSyncMessage();
      if(t >0)
      {
        RTC.set(t);   // set the RTC and the system time to the received value
        setTime(t);          
      }
    }
    
    if(minPlus == HIGH) {
      time_t t = now();
      varHr = hour(t);
      varMin = minute(t);
      varSec = second(t);
      vardd = day(t);
      varmm = month(t);
      varyy = year(t);
      varMin++;   //add 1 minute from the current tine
      setTime(varHr, varMin, varSec, vardd, varmm, varyy);
    }

    if(minMinus == HIGH) {
      time_t t = now();
      varHr = hour(t);
      varMin = minute(t);
      varSec = second(t);
      vardd = day(t);
      varmm = month(t);
      varyy = year(t);
      varMin--;   //subtract 1 minute from the current tine
      setTime(varHr, varMin, varSec, vardd, varmm, varyy);
    }

    if(hrPlus == HIGH) {
      time_t t = now();
      varHr = hour(t);
      varMin = minute(t);
      varSec = second(t);
      vardd = day(t);
      varmm = month(t);
      varyy = year(t);
      varHr++;   //add 1 hour from the current tine
      setTime(varHr, varMin, varSec, vardd, varmm, varyy);
    }

    if(hrMinus == HIGH) {
      time_t t = now();
      varHr = hour(t);
      varMin = minute(t);
      varSec = second(t);
      vardd = day(t);
      varmm = month(t);
      varyy = year(t);
      hrMinus--;    //subtract 1 hour from the current tine
      setTime(varHr, varMin, varSec, vardd, varmm, varyy);
    }
    
    delay(200); // delay to allow time to take finger off setting buttons
    
  }
}

im wondering if there is any chance of adding push button for user to adjust the time rather than connecting to the PC.

What does the program do now ? It appears to read 5 inputs as it is

What is this mysterious "PART 1/2"? Yes, you could add the code you have there with some modifications.