Switch statement only entering case 1:

My variable a which will be set by the user for the switch(a) statements, only works when variable a is == 1.

When variable a == 2 or 3, switch statement is not being entered and loop just reprints a value.

#include <NewPing.h>
char g1, g2;
boolean sensor_tripped = false;
boolean drill_complete = false;
int user_repetition = 12;
int count_repetition = 0;
int tP1 = 5;
int eP1 = 13;
int tP2 = 4;
int eP2 = 12;
int tP3 = 2;
int eP3 = 11;
int tP4 = 1;
int eP4 = 10;
int tP5 = 6;
int eP5 = 9;
int leg_length = 340;
// 300 is the maximum length which needs to be set 
// to the distance between the legs (subtract) half puck diameter 
// or not *for the ball
NewPing s1(tP1, eP1, leg_length);
NewPing s2(tP2, eP2, leg_length);
NewPing s3(tP3, eP3, leg_length);
NewPing s4(tP4, eP4, leg_length);
NewPing s5(tP5, eP5, leg_length);

void setup() {
 
  Serial.begin(9600);

  pinMode(tP1, OUTPUT);
  pinMode(eP1, INPUT);
  
  pinMode(tP2, OUTPUT);
  pinMode(eP2, INPUT);
  
  pinMode(tP3, OUTPUT);
  pinMode(eP3, INPUT);
  
  pinMode(tP4, OUTPUT);
  pinMode(eP4, INPUT);
  
  pinMode(tP5, OUTPUT);
  pinMode(eP5, INPUT);

}

void loop() {

// variable to be accepted from phone app
// chooses which drill to load
int a = 2;
Serial.println(a);
switch(a){
  case 1:
  char drill_1[]= { 'a', 'a', 'e', 'e', 'a', 'a', 'e', 'e', 'a', 'a', 'e', 'e', 'z'};
  gate_cycle(drill_1);
  break;
  case 2:
  char drill_2[]= { 'c', 'c', 'a', 'a', 'c', 'c', 'a', 'a', 'z'};
  gate_cycle(drill_2);
  break;
  case 3:
  char drill_3[]= { 'a', 'a', 'd', 'd', 'a', 'a', 'e', 'e', 'b', 'b', 'e', 'e', 'z'};
  gate_cycle(drill_3);
  break;
} // end of the switch cases
} // end of *MAIN* loop

void gate_cycle(char foo[])
{
  int i = 0;
  do
  {
    
  if (count_repetition < user_repetition)
  {
    g1 = foo[i];
    i += 1;
    g2 = foo[i];
        if(g2 == 'z')
          {
            count_repetition += 1;
            Serial.println("repetition being increased");
            Serial.println(count_repetition);
            Serial.println(user_repetition);
            if(count_repetition == user_repetition)
            {
            g2 = g1;
            }
            else
            {
              i = 0;
              g2 = foo[i];
             // 'repition' variable set by user
            }
          }
     Serial.println("Value in g1");
     Serial.println(g1);
     Serial.println("Value in g2");
     Serial.println(g2);
     lights(g1, g2);
           if(count_repetition == user_repetition)
             {
              drill_complete = true;
              Serial.println("DRILL COMPLETE");
             }
      delay(500);
//   sensor(g1,g2); to push the gates into the sensor only need 1 gate to be sensor ready
}//end of the for loop cycling through the array
  }while(!drill_complete); // end of the loop for gates
  }

void lights(char g1, char g2)
{
    if (g1 == g2)
  {
    // all lights red except for matching gate
    Serial.println("GATES MATCH");
  }
  else
  {
    Serial.println("DO NOT MATCH");
    // g1 needs to be green
    // g2 needs to be yellow
    // all other lights need to be red
  }
}

void sensor(char g1, char g2)
{

    int distance = 0;
//need to change? char gate = g1;
    switch(g1){
      case 'a':
      do
      {
      distance = s1.ping_cm();
      delay(35); 
      }while(distance >= leg_length); // might need to do leg_length - (5) or so
      do
        {
        distance = s1.ping_cm();
        if(distance >= leg_length) // might need to do leg_length - (3) or so
        {
          sensor_tripped = true;
        }
        delay(35);
        }while(!sensor_tripped);//end of do
        sensor_tripped = false;
        break;
      }//end of switch case
    }// end of sensor function


/*
 * TODO
 * SWITCH CASE CHOSEN BY USER FOR DRILL SELECTION
 * WRITE THESE DRILLS INTO ARRAY DEPENDING ON SELECTION
 * RUN ARRAY THROUGH FUNCTION TO DO DRILL
 * DRILL
 * CHANGE LIGHTS
 * CHECK SENSOR
 */
 
/*
 * RIGHT HAND DRILLS
 * 
 * #1 REACH DRILL:
 *  Gate:
 *  a - a - e - e - a - a - e - e - a - a - e - e
 *  repeat
 *  
 *  #2 Around:
 *  Gate:
 *  c - TD c - blue light a - a - c - c - blue light a - a
 *  repeat
 *  
 *  #3 Handsy Reach:
 *  Gate:
 *  a - a - d - d - a - a - e - e - b - b - e - e 
 *  repeat
 *  
 *  #4 V-Shape Drill
 *  b - b - d - e - a
 *  repeat
 *  opposite direction
 *  d - d - b - a - e
 *  repeat
 *  
 *  
 */

Do not declare variable right after “case:”

If needed, put inside a curly bracket.

For example, DO NOT do

case:
char a = 'A';
......
......
break;

Do

case:
{
      char a = 'A';
      ......
      ......
      break;
}