#include "Countimer.h"
#include <LiquidCrystal_I2C.h>

Countimer timer;
int H = 0;
int M = 0;
int S = 0;


LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup() {
  Serial.begin(9600);
lcd.begin(16, 2);

// Set up count down timer with 10s and call method onComplete() when timer is complete.
    // 00h:00m:10s
  timer.setCounter(H, M, S, timer.COUNT_DOWN, onComplete);

    // Print current time every 1s on serial port by calling method refreshClock().
    timer.setInterval(refreshClock, 1000); 
    
}

void refreshClock() {
  Serial.print("Current count time is: ");
    Serial.println(timer.getCurrentTime());
    
}

void onComplete() {
  Serial.println("Complete!!!");
  lcd.clear();
 
  lcd.setCursor(0, 1);
lcd.print("Complete!!!");
 delay(1000);
 lcd.clear();
 
}

void loop() {
   // Run timer
  
 timer.run();
 lcd.setCursor(0, 1);
  lcd.print(timer.getCurrentTime());
    
   if(!timer.isCounterCompleted()) {
      timer.start();
    }
}


