Countdown timer

so ive followed a few tutorials online with regards to countdown timers and displaying the timer on a lcd screen.

this is the code ive taken from the internet

     //Arduino Self-Timer
    //T.K.Hareendran
    //www.electroschematics.com
    #include <LiquidCrystal.h>
    LiquidCrystal lcd(12,11,5,4,3,2);
    int runTimer = 1; 
    int runFor = 60; // time in seconds
    int buzzerPin = 13;
    int relayPin=4;
    int data = 0;
     
    void setup() {
       pinMode(buzzerPin, OUTPUT);
       pinMode(relayPin,OUTPUT);
       lcd.begin(16, 2);
    }
     
    void loop() {
       if(runTimer == 1){ 
          digitalWrite(relayPin,LOW); // relay is OFF during countdown
          /* *change to HIGH if you want the relay to be ON while countdowning */
          lcd.clear();
          lcd.print("TIMER=");
          //Start timer
          timer(); 
       } else {
          digitalWrite(relayPin,HIGH); // relay is ON when time expired
          /* *change to LOW if you want the relay to be OFF when the time expired */
       }
       runTimer = 0;
       lcd.noDisplay();
       delay(250);
       for(int duration = 0; duration < 100; duration ++){
          digitalWrite(buzzerPin, HIGH);
          delayMicroseconds(500);
          digitalWrite(buzzerPin, LOW);
          delayMicroseconds(500);
       } 
       lcd.display();
       delay(250);
    }
     
    void timer() {
       for(int timer = runFor;timer > 0; --timer){
       if(timer >= 10) {
          lcd.setCursor(6,0); 
       } else {   
          lcd.setCursor(6,0);
          lcd.print("0");
          lcd.setCursor(7,0);
       }
       lcd.print(timer);
       lcd.print(" SECOND!");
       delay(1000);
       }
       lcd.setCursor(0,0);
       lcd.clear();
       lcd.print(" TIMER ALERT!");  
    }

would someone tell me / guide me towards making the program not start the countdown untill pin goes HIGH/LOW

also could someone tell me its possible to add a reset button just for the timer, and possible point me in the right direction ?

Regards

You need to post all of your code, not just small portions of it (Snippets).

ive just added the code to the top of the page, sorry i thought i had selected it all / my bad

Dont use the delay function, there is an example sketch called Blink Without Delay, if you go File::Examples::02.Digital.

Also why wait 100 seconds (1 minute, 40 seconds)?

for (int duration = 0; duration < 100; duration ++) {
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(500);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(500);
}

Your reset would be to simply make runTimer = 1 again.

So with regards to the button would what ive written down below work ? // im not one to ask for code unless ive exhausted all my options!!

  pinMode(btnReset,  runTimer = 1);

or this possibly

if(button.uniquePress()){//button.isPressed() will cause the code to execute as long as button is pressed
   //enter loop code here
runTimer = 1
   //end loop code
 }

pinMode(btnReset, runTimer = 1);

?

It should be either :
pinMode(btnReset, INPUT); //button starts LOW, then goes HIGH when pressed (you will need a pulldown resistor, 1kohm is good)
or
pinMode(btnReset, INPUT_PULLUP); // Internal pullup resistors are activated so the button starts HIGH, then expects to go LOW when pressed

button.uniquePress()

Are you using a button library? If so, where is it in the sketch you posted?

A simple if(digitalRead(btnReset) == HIGH) will work, instead of button.uniquePress().

if(digitalRead(btnReset) == LOW) // using pinMode(btnReset, INPUT_PULLUP);
  runTimer = 1;

when i run this

if(digitalRead(resetBtn) == LOW) // using pinMode(btnReset, INPUT_PULLUP);
  runTimer = 1;

i get an error of the following

MY_CODE.ino:3:1: error: expected unqualified-id before numeric constant
MY_CODE.ino:10:1: error: expected ',' or ';' before 'void'
Error compiling.

Post your updated code.

i realised what was wrong with the code, when i had set the

 int btnReset = 50

id missed the

 ;