Arduino Timer with increase time button.

Hello , sorry for my topic , i have a project to do , with arduino , to make an countdown timer (i make that already) .I connect a push button , and i want when press the buton to increase time with 10+ seconds.
Cand anyone help me with the code for the button?

there is the code:(i declared the button, i don’t know if is good)

#include <LiquidCrystal.h>

int buttonPin = 7;
int buttonState = 0;
int S = 30; // count seconds
int M = 0; // count minutes
int H = 0; // count hours
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
//initialize the library with the numbers of the interface pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // pins connected to LCD

void setup()
{
lcd.begin(16,2);//set up the LCD’s number of columns and rows
pinMode(buttonPin, INPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin);
lcd.setCursor(1,0);
lcd.print (“Sosire in:”);
lcd.setCursor(6,1);
lcd.print(":");
lcd.setCursor(9,1);
lcd.print(":");

S–;
delay(1000);

if(S<0)
{
M–;
S=59;
}
if(M<0)
{
H–;
M=59;
}
if(H<0) { H=0; M=0; S=30; } if(M>9)
{
lcd.setCursor(7,1);
lcd.print(M);
}
else
{
lcd.setCursor(7,1);
lcd.print(“0”);
lcd.setCursor(8,1);
lcd.print(M);
lcd.setCursor(9,1);
lcd.print(":");
}

if(S>9)
{
lcd.setCursor(10,1);
lcd.print(S);
}
else
{
lcd.setCursor(10,1);
lcd.print(“0”);
lcd.setCursor(11,1);
lcd.print(S);
lcd.setCursor(12,1);
lcd.print(" ");
}

if(H>9)
{
lcd.setCursor(4,1);
lcd.print (H);
}
else
{
lcd.setCursor(4,1);
lcd.print(“0”);
lcd.setCursor(5,1);
lcd.print(H);
lcd.setCursor(6,1);
lcd.print(":");
}
if(S==0)
{
lcd.clear();
lcd.print(“Este in statie”);
delay(5000);
lcd.clear();
}

}

Have a look at the StateChangeDetection example in the IDE.

It will show you how to detect when a button becomes pressed. When you detect that you can run code to do what you want

There is, however, a problem with your program in that it uses delay(). At best that will make it unresponsive to user input. Have a look at Using millis() for timing. A beginners guide, Several things at the same time and look at the BlinkWithoutDelay example in the IDE to see how you implement timing in your program whilst it remains responsive to inputs.

I am a beginner and i don't know how to use good these.Can you help me with the code sequence? And i'm not so good with english ,and i find it difficult.

I am not sure exactly how I can help you without writing the program for you. Start with the StateChangeDetection example. Do you see how it detects when a button becomes pressed ?

i connected the button how is in "StateChangeDetection example".i just need the sequence code ,when i press the button increase the time with 10+ second.

Have you looked at the example ?

Do you see how it increases a number when the button becomes pressed ?

  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
      // if the current state is HIGH then the button went from off to on:
      buttonPushCounter++;

I tried a lot of codes , it doesn't work...:(

Show us what you tried