Thank you Arduarn,
It is working now. I reattach my complete code below :-
#include<CountUpDownTimer.h>
#include "SevSeg.h"
CountUpDownTimer T(DOWN, HIGH); // Default precision is HIGH, but you can change it to also be LOW
SevSeg sevseg; //Instantiate a seven segment controller object
void setup()
{
Serial.begin(115200);
T.SetTimer(4,50,20); //start at 2 minute, 20 sec (USE FOR: DOWN ONLY)
T.SetStopTime(0,0,30); // stop at 10 seconds (USE FOR: UP/DOWN)
T.StartTimer();
//Setup for Seven Segment Display
byte numDigits = 4;
byte digitPins[] = {A0, A1, A2, A3};
byte segmentPins[] = {2, 3, 4, 8, 9, 10, 11, 12};
bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
byte hardwareConfig = COMMON_CATHODE; // See README.md for options
bool updateWithDelays = false; // Default. Recommended
bool leadingZeros = false; // Use 'true' if you'd like to keep the leading zeros
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
sevseg.setBrightness(90);
}
//void setChars(char str[]);
//void setNumber(unsigned int numToShow, char decPlaces=-1, bool hex=0);
void loop()
{
T.Timer(); // run the timer
if (T.TimeHasChanged() ) // this prevents the time from being constantly shown.
{
Serial.print(T.ShowHours());
Serial.print(":");
Serial.print(T.ShowMinutes());
Serial.print(":");
Serial.println(T.ShowSeconds());
char bufferHour[8];
sprintf (bufferHour, "%02d", T.ShowHours());
Serial.println(bufferHour);
char bufferMinutes[8];
sprintf (bufferMinutes, "%02d", T.ShowSeconds());
Serial.println(bufferMinutes);
char timestr[100];
strcpy (timestr,bufferHour);
strcat (timestr,bufferMinutes);
sevseg.setChars(timestr);
}
sevseg.refreshDisplay();
}
My next problem now is the sevseg.h library do not have a way to display the time double dots.
My double dots is light up with dp(pin11 +) and com2 (-) and dp(pin 11 +) and com3 (-). How to modify this into the sevseg library ?