I had a much closer look, and have noticed a few problems.
Firstly, your digits array is not properly initialised. You used “( )” not “{ }”. This is what it should be:
byte digits [10][8] = {
// a b c d e f g .
{1,1,1,1,1,1,0,0}, //0
{0,1,1,0,0,0,0,0}, //1
{1,1,0,1,1,0,1,0}, //2
{1,1,1,1,0,0,1,0}, //3
{0,1,1,0,0,1,1,0}, //4
{1,0,1,1,0,1,1,0}, //5
{1,0,1,1,1,1,1,0}, //6
{1,1,1,0,0,0,0,0}, //7
{1,1,1,1,1,1,1,0}, //8
{1,1,1,1,0,1,1,0} //9
};
Secondly, It wasn’t counting. The way you had written the program, seconds was always set to 59, and minutes never changed. Here is a changed version:
void updateCountingTime()
{
static unsigned long lastMillis = 0; //Initial time is 0
unsigned long m= millis(); //get the current time
if (m> (lastMillis + 1000) && (timerSecond > 0 || timerMinute >0))
{
//if a second has passed, and there is time left on the clock
digitalWrite(buzzerPin, HIGH);
delay(10);
digitalWrite(buzzerPin, LOW);
if (timerSecond == 0)
{
//reached 0 seconds
if(timerMinute > 0)
{
//if there are still minutes on the clock, reduce minutes by one and reset seconds to 59
timerSecond = 59;
timerMinute--;
}
} else {
timerSecond--;
}
lastMillis = m; //update last clock time
}
}
I haven’t got an display to test it with, but I output the value being sent to the setDigit() function over the serial port, and it appears to count down now as it should.