Adjusting DS3231 RTC clock time in a sketch

Hi.

I’m making a outdoor scoreboard and want to include a clock. I’ve altered a sketch by “LucidTronix” to display hours and minutes only (sketch show below). I’m running the digit display via TIP6B595 shift registers and common anode 7 segment digits.

I’ve been able to set the time on the DS3231 which is now displaying on the digits. I’d now like to change the sketch so that a button (or number of buttons) could “adjust” the time (i.e. set the seconds to say 00), and increment the minutes to fine adjust the time remotely rather than re-loading the code. Can someone please point me in the right direction please.

/*********************************************************************

4 x single 7 segment digit display clock with 4 x shift registers

This uses 4 x TPIC6B595 shift registers, 4 x 1/2 inch common
anode digits, 4 x 100 ohm network resistors (7 resistors each),
an Arduino Uno and a DS3231 RTC.

Modfied version of :http://www.lucidtronix.com/tutorials/52

**********************************************************************/

#include <Wire.h>
#include <RTClib.h>


RTC_DS1307 RTC;

const int dataPin = 12;  // arduino pin 12 to TPIC6B595 pin 3 serial in (SER IN)
const int latchPin = 10; // arduino pin 10 to TPIC6B595 pin 12 latch signal (RCK)
const int clockPin = 9;  // arduino pin 9 to TPIC6B595 pin 13 clock (SRCK)
const int ldrIn = A0;    // arduino pin A0 to leg 1 of the LDR as well as leg 1 of a 10K resistor
                         // LDR leg 2 to GND and leg 2 of the 10K to 5V
const int dimPin = 3;    // arduio pin 3 connected to the TPIC6B595 pin 13 (Output Enable)
int ldrVal = 0;          // variable to store the value coming from the sensor

const int digits[10] = {63, 6, 91, 79, 102, 109, 125, 7, 127, 111};

/* The above decimal value is used to display numbers 0 to 9 based on:
         1
     -----------
     |         |
32   |         | 2
     |   64    |
     |---------|
     |         |
16   |         | 4
     |   8     |
     |---------|

Using above, "0" is 1+2+4+8+16+32=63.  "1" is 2+4=6. Etc, etc.
*/

void setup() {
  Serial.begin(9600);

  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(dimPin, OUTPUT);  // declare also the dimPin as an OUTPUT

  Wire.begin();
  RTC.begin();
  if (! RTC.isrunning()) {
    RTC.adjust(DateTime(__DATE__, __TIME__));
  } // end if
} // end void setup


void loop() {
  DateTime now = RTC.now();
  int thehour = now.hour();
  // switch between 24 hour clock and 12 hour clock
  // if (thehour > 12 ) thehour -= 12;
  int hour_tens = thehour / 10;
  int hour_ones = thehour % 10;
  int minute_tens = now.minute() / 10;
  int minute_ones = now.minute() % 10;
  int second_tens = now.second() / 10;
  int second_ones = now.second() % 10;

  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, MSBFIRST, digits[hour_tens]);
  shiftOut(dataPin, clockPin, MSBFIRST, digits[hour_ones]);
  shiftOut(dataPin, clockPin, MSBFIRST, digits[minute_tens]);
  shiftOut(dataPin, clockPin, MSBFIRST, digits[minute_ones]);
//  shiftOut(dataPin, clockPin, MSBFIRST, digits[second_tens]);
//  shiftOut(dataPin, clockPin, MSBFIRST, digits[second_ones]);

  //take the latch pin high so the LEDs will light up:
  digitalWrite(latchPin, HIGH);

  // set digit brightness:
  setBrightness();
} // end void loop


void setBrightness() {
  ldrVal = analogRead(ldrIn);            // read the value from the light dependant resistor
  //  Serial.print("ldrIn value (0-1023):  ");
  //  Serial.print(ldrVal);
  ldrVal = constrain(ldrVal, 600, 1023);
  ldrVal = map(ldrVal, 600, 1023, 0, 254);  // scale it to use it with the LED - map to 254, cause 255 is complete off
  //  Serial.print(".  Corresponding 0-255 value: ");
  //  Serial.println(ldrVal);
  analogWrite(dimPin, ldrVal);            // set brightness on TPIC6B595s
} // end void setBrightness