60 Second countdown using a 2 digit Seven second display

Hi guys,

so I'm trying to make a 60 second countdown timer using an arduino uno. i want it to start the countdown when a push button is pushed, and stop at 0 until the push button is hit again. thus making it start at 60 and count to 0 again. I literally have no idea how to do this. i found some code counting down from 9 - 0 using a 1 digit seven segment display, but it loops and i have no idea how to adjust it to make it 2 digits and count from 60. Any ideas or tips would help alot! This is my first time using an arduino! only other microcontroller i programmed was a 8051 and that was assembly code! much different from C code. Thanks for any help that you can provide!!

Code????????
Schematic????????
Do you think we're mindreaders?

found some code counting down from 9 - 0 using a 1 digit seven segment display

Show us this code and the schematic that goes with it.

I have some code on my repository (link below) for a countdown timer that may be useful for you.

Silveira89:
I literally have no idea how to do this.

Do you have any interest in knowing or do you just want a gadget? Learning to do it will require a lot of time (but you'll be able to do other things as well as timers).

I havent really started coding it yet. its my first time using an arduino so im not sure how to code a timer for it. i know how to make a timer and i know C code im just having difficulty bridging the two. The following Code is code i have for a countdown from 9 to 0, but im not sure how to get it to 60 and i dont want it to loop. but i can only seem to get it to work in a loop

// Define the LED digit patters, from 0 - 9
// Note that these patterns are for common cathode displays
// For common anode displays, change the 1's to 0's and 0's to 1's
// 1 = LED on, 0 = LED off, in this order:
// Arduino pin: 2,3,4,5,6,7,8
byte seven_seg_digits[10][7] = {
{
0,0,0,0,0,0,1 }
, // = 0
{
1,0,0,1,1,1,1 }
, // = 1
{
0,0,1,0,0,1,0 }
, // = 2
{
0,0,0,0,1,1,0 }
, // = 3
{
1,0,0,1,1,0,0 }
, // = 4
{
0,1,0,0,1,0,0 }
, // = 5
{
0,1,0,0,0,0,0 }
, // = 6
{
0,0,0,1,1,1,1 }
, // = 7
{
0,0,0,0,0,0,0 }
, // = 8
{
0,0,0,1,1,0,0,0,1,1 } // = 9
};

void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
writeDot(0); // start with the "dot" off
}

void writeDot(byte dot) {
digitalWrite(9, dot);
}

void sevenSegWrite(byte digit) {
byte pin = 2;
for (byte segCount = 0; segCount < 7; ++segCount) {
digitalWrite(pin, seven_seg_digits[digit][segCount]);
++pin;
}
}

void loop() {
for (byte count = 10; count > 0; --count) {
delay(1000);
sevenSegWrite(count - 1);
}
delay(4000);
}

Place your code inside "code tags"

  • Copy your code
  • Click the # gadget (post/message toolbar) and then paste your code between the two html prompts [ code ] [ /code ]

This will countdown once:

boolean passthru = false;
byte tens;
byte ones;

void setup ()
{
  Serial.begin(9600);
}

void loop ()
{
  if (passthru == false)
  {
    for (int counts=60; counts > -1; counts--)
    {
      tens = counts/10;
      ones = counts % 10;
      Serial.print(tens,DEC);
      Serial.print(" ");
      Serial.print(ones,DEC);
      Serial.print("\r\n");
      delay (1000);    
    }
    passthru = true;
  }
  // digitalRead switch for "do again"
  // >>> make passthru = false
}

Upload it, click the Serial Monitor button, and observe.