STOPPING COUNTDOWN WITH A SWITCH

Hello Arduino enthusiast.

I've been trying to figure out how can I able to stop the countdown which I have already started by pressing the button and stop using another button? Anybody who can help me on this? Thanks a lot.

Anybody who can help me on this?

Without seeing your code? Not really.

if switch is pressed,
toggle a flag to indicate circuit to be deactivated
if countdown clock is >2, keep counting
if countdown clock <2 and flag is toggled, stop timer.

I think this is what they used in Galaxy Quest to stop the self destruct
the code was written by the Thermians, based on the televised TV show.

I am a bit confused as to whether to start the void loop with detecting the switch first being pressed and start the countdown or make for loop to start the countdown and detect the switch being pressed? Been pondering for 2 days now.

This is what I intend to do:

  1. upon power up, the 7segment displays 60
  2. when a button is pressed, the countdown starts
  3. when the same button is pressed again, it stop the countdown
  4. when another button is pressed the countdown timers resets to 60?

ANy suggestions please. thanks

set a flag in void setup()

hold_reading=1;
// set your display to read 60:00

then in void loop()

if(hold_reading == 0){
// run your count down
}

use button to toggle the flag to hold_reading.

you could press and hold the button for 2 seconds to re-set the reading
read about debounce
you can have two debounce results, 1 for a fast press and a second for a long hold of the button.

what you should do is to read the sticky on the top of every forum, itme #7 about code tags

write your sketch to count down.

if you get it to work great !
if you have a problem,

auto format your sketch // menu selection on your IDE
then use code tags and post it here.

Thanks dave. I'll try to fix my code with your suggestions.