Aiuto per espandere il codice del mio progetto

ciao sto provando a modificare il codice come mi hai suggerito tu e forse ci sono riuscito

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>

unsigned long myOldTime;
unsigned long pausa = 5000;
int S = 5; // count seconds
int M = 0; // count minutes
int H = 0; // count hours

const byte ROWS = 4; //4 Righe
const byte COLS = 4; //4 Colonne

char hexaKeys[ROWS][COLS] = {  //definire i simboli e i numeri sulla tastiera
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {4, 3, 2, 1}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6, 5}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display

void Countdown() {

}

void Password() {

}
void setup()
{
  lcd.init();                      // initialize the lcd
  // Print a message to the LCD.
  Serial.begin(9600);
  lcd.backlight();                 //noBlacklight per oscurare schermo
  lcd.setCursor(4, 0);
  lcd.print("S.M.A.S.");
  lcd.setCursor(3, 1);
  lcd.print("La Bombaaa!");
  delay(5000);
  lcd.clear();

}

void loop()
{
  // lcd.clear();        // Start with a blank screen
  lcd.setCursor(3, 0);
  lcd.print ("Countdown!");
  lcd.setCursor(6, 1);
  lcd.print(":");
  lcd.setCursor(9, 1);
  lcd.print(":");


  S--;
  delay(1000);
  if (S < 0)
  {
    lcd.setCursor(1, 0);
    lcd.print("Tempo Scaduto");
    lcd.setCursor(3, 1);
    lcd.print("Sei Morto!");
    myOldTime = millis();

    if ( millis() - myOldTime >= pausa) {   // Wait for 5 sec
      lcd.clear();
      lcd.setCursor(3, 0);
      lcd.print("Riavviare!");
    } else {
      // esegui altre cose fino a quando la if diventa vera
    }
  }
  if (M < 0)
  {
    H--;
    M = 59;
  }
  if (H < 0)
  {
    H = 23;
    M = 59;
    S = 59;
  }
  if (M > 9)
  {
    lcd.setCursor(7, 1);
    lcd.print(M);
  }
  else
  {
    lcd.setCursor(7, 1);
    lcd.print("0");
    lcd.setCursor(8, 1);
    lcd.print(M);
    lcd.setCursor(9, 1);
    lcd.print(":");
  }

  if (S > 9)
  {
    lcd.setCursor(10, 1);
    lcd.print(S);
  }
  else
  {
    lcd.setCursor(10, 1);
    lcd.print("0");
    lcd.setCursor(11, 1);
    lcd.print(S);
    lcd.setCursor(12, 1);
    lcd.print(" ");
  }

  if (H > 9)
  {
    lcd.setCursor(4, 1);
    lcd.print (H);
  }
  else
  {
    lcd.setCursor(4, 1);
    lcd.print("0");
    lcd.setCursor(5, 1);
    lcd.print(H);
    lcd.setCursor(6, 1);
    lcd.print(":");
  }
}

Però sul display una volta che il countdown finisce si sovrappone la scritta countdown (e il tempo continua a score in negativo,non c'è una funzione per bloccarlo a 00:00:00) e la scritta che spunta dopo cioè "Tempo Scaduto"/ "sei morto"

ho sbagliato ad inserire il codice?

Altra domanda con il codice del countdown che sto utilizzando va bene anche per quando inserirò la tastiera cosi da impostare il tempo che voglio dalla valigetta?