Two button two option

@Tiziano_Faverzani
A: 1. You have a system with two buttons that are connected with external pull-down resistors. Correct? (The buttons can be connected with internal pull-up resistors enabled, Fig-1.)

2. Your system should not do anything until one of the buttons is activated/pressed. Correct?

3. If Button1 is pressed you execute the routine named: imp1_1(). Correct?
4. If Button2 is pressed you execute the routine named: imp2(). Correct?

B: Then why don't you proceed to wrtite the following sequential codes to realize your objectives?
1. Connect your buttons as per Fig-1 with internal pull-up resistors.

sw2led2
Figure-1:

2. Let us agree that L (Built-in LED of UNO) will blink for three times when Button-1 is closed. This is your function named: imp1_1().

3. Let us agree that LED1 will blink for five times when Button-2 is closed. This is your function named: imp2().

4. Upload the following sketch and check the functionality of the circuit by pressing Button1 and Button2.

#define L 13
#define LED2 6

void setup() 
{
  Serial.begin(9600);
  pinMode(8, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(L, OUTPUT);
  pinMode(LED2, OUTPUT);
  Serial.println(!Button1.read(), BIN);
}

void loop() 
{
  while((digitalRead(8) == HIGH) && (digitalRead(12) == HIGH))
  {
    ;    //wait until one of the buttons is closed
  }
  if(digitalRead(8) == LOW)
  {
    imp(L, 3);  //Button1 is pressed, blink L 3 times
  }
  if(digitalRead(12)== LOW)
  {
    imp(LED2, 5);   //Button2 is pressed, blink LED2 for 5 times
  }
}

void imp(int m, int n)
{
  for(int i=0; i<n; i++)
  {
    digitalWrite(m, HIGH);
    delay(1000);
    digitalWrite(m, LOW);
    delay(1000);
  }
}