 void loop() {
   int16_t joyL = analogRead(JOYPIN_L);
   int16_t joyR = analogRead(JOYPIN_R);
+  if (potSpeedControl == true){spd = map(analogRead(SPEEDPOT_PIN), 0, 1023, 28, 64);}
   paddleL = map(joyL, 0, 1023, 0, 59);
   paddleR = map(joyR, 0, 1023, 0, 59);
   

#define PADDLE_XR 126

#define SPD0 0
#define SPD1 48 //Ball speed - the smaller this number is, the faster the ball goes

#define JOYPIN_L 2 //Analog pin of the left joystick
#define JOYPIN_R 0 //Analog pin of the right joystick

int16_t joyYL;
int16_t joyYR;
int16_t paddleL;
int16_t paddleR;
uint8_t movementVal;

    lastballY = 32;
  }
  if (i == UP_RIGHT) {
    ballX = lastballX + map(movementVal, SPD0, spd, 0, 128);
    ballY = lastballY - map(movementVal, SPD0, spd, 0, num);
  } else if (i == UP_LEFT) {
    ballX = lastballX - map(movementVal, SPD0, spd, 0, 128);
    ballY = lastballY - map(movementVal, SPD0, spd, 0, num);
  } else if (i == DOWN_RIGHT) {
    ballX = lastballX + map(movementVal, SPD0, spd, 0, 128);
    ballY = lastballY + map(movementVal, SPD0, spd, 0, num);
  } else if (i == DOWN_LEFT) {
    ballX = lastballX - map(movementVal, SPD0, spd, 0, 128);
    ballY = lastballY + map(movementVal, SPD0, spd, 0, num);
  }
}

