Arduino LCD Chess Clock for L5R

Hey guys and dolls,

I want to create a chess clock for a card game I play. I have a little bit of Arduino experience and with a little bit I mean not a lot. So I was wondering if I could get some help here.
To give a little context. In the card game, there exist 7 clans. If possible I would like a menu where you get to choose which clan you represent. When those are chosen, you get to set the timer. Up to 1 hour per player I would say. Just like a regular chess clock I would like 2 buttons for the players to press to pause their timer. In the attachments I made a small example of what I would like.

HELP! :o

WARNING: I have not tested this, so there might be bugs.
But, I believe that this will work as a sort of framework for a chess clock.

I do not know how exactly you have your buttons, etc., set up, so you will have to write code to change the value of leftClockStep and/or rightClockStep when a button is pressed. You will also have to write code to make the time show up on the LCD.

// variable declarations for time
// Change them to whatever number of hours, minutes, and seconds you wish.
int leftHours    = 0;
int leftMinutes  = 5;
int leftSeconds  = 0;
int rightHours   = 0;
int rightMinutes = 5;
int rightSeconds = 0;

// other variables for timekeeping
unsigned long lastTimeUpdate = 0; // micros() value when the clock was last updated
int leftClockStep = 0;  // 0 for paused; 1 for counting up; -1 for counting down
int rightClockStep = 0; // 0 for paused; 1 for counting up; -1 for counting down

char buf[20]; // buffer for output

void setup() {
  Serial.begin(115200); // set baud rate for Serial
}

void loop() {
  
  // This next part is what makes our clock keep time.
  // First, we check if it is time to update the clock.
  // (We only update the clock once per second.)
  if ((micros() - lastTimeUpdate) >= 1000000UL) {
    
    // We add time to, or subtract time from, each clock as necessary.
    leftSeconds  += leftClockStep;
    rightSeconds += rightClockStep;
    
    // We do any necessary arithmetic for the minutes and hours.
    if (leftSeconds < 0) {
      leftSeconds += 60;
      leftMinutes -= 1;
    }
    if (leftSeconds >= 60) {
      leftSeconds -= 60;
      leftMinutes += 1;
    }    
    if (leftMinutes < 0) {
      leftMinutes += 60;
      leftHours -= 1;
    }
    if (leftMinutes >= 60) {
      leftMinutes -= 60;
      leftHours += 1;
    }
    if (leftHours < 0) {
      // if it goes below zero, then just set it to zero
      leftHours = 0;
      leftMinutes = 0;
      leftSeconds = 0;
    }
    if (rightSeconds < 0) {
      rightSeconds += 60;
      rightMinutes -= 1;
    }
    if (rightSeconds >= 60) {
      rightSeconds -= 60;
      rightMinutes += 1;
    }    
    if (rightMinutes < 0) {
      rightMinutes += 60;
      rightHours -= 1;
    }
    if (rightMinutes >= 60) {
      rightMinutes -= 60;
      rightHours += 1;
    }
    if (rightHours < 0) {
      // if it goes below zero, then just set it to zero
      rightHours = 0;
      rightMinutes = 0;
      rightSeconds = 0;
    }
    
    // And we schedule the next update for one second later.
    lastTimeUpdate += 1000000UL;  
  }
  
  // A clock isn't much use if you have no way of seeing the time.
  // So...
  // This next line composes a string showing the time remaining for each player:
  sprintf(buf,"%d:%02d%02d  %d:%02d:%02d",leftHours,leftMinutes,leftSeconds,rightHours,rightMinutes,rightSeconds);
  // (That string should look something like this: "0:00:00  0:00:00")
  // And this next line writes that string to the Serial monitor:
  Serial.print(buf);
  
  // You can also write that string to an LCD display if you wish.
  // But, I'm not sure how you have your display wired up,
  // so I'll skip that part for now.  
}

Thanks for your reply, I might have forgot to mention it. Though it showed in the image, I am using a LCD 16x2 keypad shield. So need to use LiquidCrystal(lcd). So not sure if serial will work?

DaveyVerhoef:
Thanks for your reply, I might have forgot to mention it. Though it showed in the image, I am using a LCD 16x2 keypad shield. So need to use LiquidCrystal(lcd). So not sure if serial will work?

I'm not sure either. To start, I'm not sure which shield in particular you have, or what library (if any) you are using to control it.
Where did you get this shield from? Does it have a model number? Did the seller recommend that you use any specific software to control it? For example, did they provide an example sketch for you to run?

The only reason I used Serial in my example code was so that there would be some way for the Arduino to output information. If you can output information to the LCD, then you can use that instead of Serial.

Can you get your LCD to display anything, even if it's just something silly like "This is a test" or "ABC 123"? That would be a good first step.