Countdown without a Library

Helly guys and gals!

I want to implement a little countdown in my program but I am unsure how to do this.

I have an array which stores time values such as

{10, 20, 30, 40, 50, etc....}

A “millis” timer is being used to increment an index based on this time.

if (currentMillis - theStartTime > stepTime[index] * 60000UL) {  // 60000UL to convert the array time to minutes          
  startCountdown = false;      
  index++;                
}

Parallel to this I want to display this time as a “countdown” on an LCD.
So if the time from the array is 15 (minutes), I want this time to countdown to 0 (when the “millis” timer runs out). This could happen in intervals of 1 minute.

15, 14, 13, 12, etc.

Can this be achieved easily?

Thanks!

The amount of time you are looking for would be equal to stepTime[index] - (currentMillis - theStartTIme) would it not? So just print that number out to the screen. You may need some conversion if you want to display in minutes, but that's the time you want is it not?

Delta_G: The amount of time you are looking for would be equal to stepTime[index] - (currentMillis - theStartTIme) would it not? So just print that number out to the screen. You may need some conversion if you want to display in minutes, but that's the time you want is it not?

Yep that was it! Thank you!