How can i pause and show that time i stopped this code in display?
something like case flash zeros
#include <TM1637Display.h>
#define numberofseconds(_time_) ((_time_ / 1000) % 60)
#define numberofminutes(_time_) (((_time_ / 1000) /60) % 60)
#define gameled 13
const uint8_t ZEROS[] = {0b00111111, 0b00111111, 0b00111111, 0b00111111 };
const uint8_t OFF[] = {0, 0, 0, 0};
// in the libary, the byte order is .GFEDCBA
// .GFEDCBA
const uint8_t PLAY[] = {B01110011, B00111000, B01110111, B01101110};
//clock, data
TM1637Display display(7, 6);
// 1000ms in one sec, 1000x60x60 = 3600000ms = 1hour 300000 = 5min
const unsigned long timeLimit = 60000;
unsigned long timeStart;
bool bcountdownDone;
void setup()
{
Serial.begin(9600);
display.setBrightness(0x0d);
display.setSegments(OFF);
pinMode(gameled, OUTPUT);
display.setSegments(PLAY);
timeStart = millis(); //used to time display of PLAY
}//setup
#define ST_SHOWPLAY 0
#define ST_COUNT 1
#define ST_FLASH_ZEROS 2
void countdown()
{
static byte
stateCountdown = ST_SHOWPLAY;
//the vars used by countdown state
static bool
bcountdownDone = false;
int
seconds,
minutes;
static int
lastseconds = -1;
unsigned long
timeRemaining,
timeElapsed;
switch( stateCountdown )
{
case ST_SHOWPLAY:
//PLAY is showing from setup...time to start countdown?
if( (millis() - timeStart) > 2000 )
{
stateCountdown = ST_COUNT;
timeStart = millis();
}//if
break;
case ST_COUNT:
timeElapsed = millis() - timeStart;
timeRemaining = timeLimit - timeElapsed;
seconds = numberofseconds(timeRemaining);
minutes = numberofminutes(timeRemaining);
if( seconds != lastseconds )
{
lastseconds = seconds;
display.showNumberDecEx(seconds, 0, true, 2, 2);
display.showNumberDecEx(minutes, 0x80>>3, true, 2, 0);
}//if
if( seconds == 0 && minutes == 0 )
{
digitalWrite( gameled, HIGH );
stateCountdown = ST_FLASH_ZEROS;
}//if
break;
case ST_FLASH_ZEROS:
FlashZeros();
break;
}//switch
}//countdown
void loop()
{
countdown();
}//loop
void FlashZeros( void )
{
static bool
bState = true; //reflect that countdown left digits at 0000 to begin
static unsigned long
timeFlash = 0;
if( millis() - timeFlash > 300 )
{
timeFlash = millis();
if( bState )
{
display.setSegments(OFF);
bState = false;
}//if
else
{
display.setSegments(ZEROS);
bState = true;
}//else
}//if
}//FlashZeros