firstTimePong

I’m trying to implement a pong game step by step, the first of which is drawing a paddle over and over using a Pot.
I created a function to do this but keep getting an error saying ("jump to case label [-fpermissive] ")

I just need someone to go over the logic and make sure what I’m doing can work and why its not working yet.

I did try setting a default case to see if it would compile on the chance no case was reached.
the pot value is correctly mapped so it can only be 1-12.

#include <LiquidCrystal.h>
int x;
int potVal;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  pinMode(A0, INPUT);

}

void loop() {
  x = analogRead(A0);
  potVal = map(x, 0, 657, 0, 12);

 drawPongPaddle(potVal);

}

void drawPongPaddle(int potVal ){
  

  switch(potVal){
    case 1: 
    byte firstPosition[8] = {
  B10000,
  B10000,
  B10000,
  B00000,
  B00000,
  B00000,
  B00000,
};
     lcd.createChar(0, firstPosition);
     lcd.setCursor(0, 0);
     lcd.write(byte(0));


    break;
    case 2:
     byte secondPosition[8] = {
  B00000,
  B10000,
  B10000,
  B10000,
  B00000,
  B00000,
  B00000,
};
lcd.createChar(0, secondPosition);
     lcd.setCursor(0, 0);
     lcd.write(byte(0));

    

     break;
    case 3:

    break;
    case 4:

    break;
    case 5:


    break;
    case 6:


    break;
    case 7:

    break;
    case 8:

    break;
    case 9:

    break;
    case 10:

    break;
    case 11:

    break
    case 12:

    break;


    

 
  }


  

  
}

What's the line number of the error message, and the content of that line?

The byte arrays should be declared as "const byte", and with an array of such arrays you can eliminate the entire switch.

Even simpler, have a single larger byte array, and select the right start address for createChar.
Untested!
const byte Paddle = { 0, 0, 0, 0, 0, 0, 0, 0,
0b10000, 0b10000, 0b10000, 0b10000,
0, 0, 0, 0, 0, 0, 0, 0 };
Then this should work:
lcd.createChar(0, Paddle+potVal);

You can not create local variables in a case statement. You can create local variables in a block in a case statement. So, make a block.

Although I agree with DrDiettrich that such variables are the wrong way to go.