Cumulative Countdown Timer

I am new to arduino and I am trying to make a cumulative countdown timer using my Arduino Uno to shut off a relay when the timer is up. I am able to get the relay working using the blinking LED code found online.

I want to use a push button so that every time it is pushed it will add 5sec to the countdown timer.

Like I said I am new to this but I have a little understating. Any help or insight would be a great help.

Thanks

Any of your code you care to post would be an even greater help.

The code is just a simple one and im not sure if it will even work for what I am trying to do. But I can turn the relay on and off with the 5V, GND and #13 pin. Here is the code.

int ledPin = 13; // LED connected to digital pin 13

void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output }

void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(100000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(100000); // waits for a second }

every time it is pushed it will add 5sec to the countdown timer

There is no countdown timer in your code

I know I have no clue how to add it to the code or the back bone of the timer. Basically I need help creating the code from scratch.

The blink without delay example is great introduction to handling time and timers.

delay(100000);                  // waits for a second

That's a bit longer than a second.


Rob

Tylmcnaney: Like I said I am new to this but I have a little understating. Any help or insight would be a great help.

I know what it is to be in the beginning, it sucks for some time.

Ok, first. Your delay is a bit long, and you should learn what these functions do by going to Reference page on the main site. Delay likes milliseconds, so your delay is now 100 secs.

Do you know how to read that pull button you mentioned? Go and learn digitalRead(). Do you have a variable where you add you extra 5 secs (5000ms)? Learn about variables and types. Do you know what is the easiest way to create time countdown, the one you compare your total delay? Learn about millis() function.

Then do some math. Try these, and we help you more.

Cheers, Kari