#include "SevSeg.h"
SevSeg a;
const int cln = 7;
long currentTime;
long pastTime = 0;
static int second = 0;
static int minute = 0;
void setup() {
// put your setup code here, to run once:
byte numdigits = 4;
byte digitPins[] = {10,11,12,13};
byte segmentPins[] = {0,1,2,3,4,5,6};
bool resistorsOnSegments = false;
byte hardwareConfig = COMMON_ANODE;
bool updateWithDelays = false;
bool leadingZeros = true;
bool disableDecPoint = true;
a.begin(hardwareConfig, numdigits, digitPins, segmentPins, resistorsOnSegments,
updateWithDelays, leadingZeros, disableDecPoint);
a.setBrightness(90);
pinMode(cln, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
currentTime = millis();
if (currentTime-pastTime == 1000 && currentTime<=9999000){
clnOn(cln);
second++;
if (second>=60){
minute++;
second = second-60;
}
a.setNumber(minute*100+second);
pastTime = currentTime;
clnOff(cln);
}
a.refreshDisplay();
}
void clnOn(const int clnPin){
digitalWrite(clnPin,LOW);
}
void clnOff(const int clnPin){
digitalWrite(clnPin,HIGH);
}