#include <LiquidCrystal.h>

LiquidCrystal lcd(7,6,5,4,3,2);
volatile bool enableTimer = true;
volatile unsigned long currentTime;

void setup() {
  lcd.begin(16,2);
  
  //pull-up resistors activated
  pinMode(20, INPUT);
  pinMode(21, INPUT);
  digitalWrite(20, HIGH);
  digitalWrite(21, HIGH);

  // Attach ISRs to the interrupts corresponding to pins 21 and 20 (INT0 and INT1)
  attachInterrupt(digitalPinToInterrupt(20), startStopTimer, RISING);
  attachInterrupt(digitalPinToInterrupt(21), resetTimer, RISING);
}

void loop() {
  if (enableTimer) {
    displayValue(currentTime);
    currentTime++;
    delay(1000);
  }
}

void displayValue(const unsigned long value) {
  lcd.setCursor(0,0);
  lcd.print(currentTime);
}

// First ISR function
void startStopTimer() {
  enableTimer = !enableTimer;
}

// Second ISR function
void resetTimer() {
  lcd.clear();
  currentTime = 0;
  displayValue(currentTime);
}