Problem with my 2 Axis Analog Joystick

Hello, i Use a Arduino Leonard to make a controller. I use this code:

#include <Joystick.h>
Joystick_ Joystick;
int Eje_x = A0;
int Eje_y = A1;

const bool initAutoSendState = true;
void setup()
{

  • pinMode(9, INPUT_PULLUP);*
  • pinMode(10, INPUT_PULLUP);*
  • pinMode(11, INPUT_PULLUP);*
  • pinMode(12, INPUT_PULLUP);*
  • Joystick.begin();*
  • }*
    const int pinToButtonMap = 9;
    int lastButtonState[4] = {0,0,0,0};

void loop(){
for (int index = 0; index < 4; index++)

  • {*
  • int currentButtonState = !digitalRead(index + pinToButtonMap);*
  • if (currentButtonState != lastButtonState[index])*
  • {*
  • Joystick.setButton(index, currentButtonState);*
  • lastButtonState[index] = currentButtonState;*
  • }*
  • }*
    Joystick.setXAxis(analogRead(Eje_x)/2);
    Joystick.setYAxis(analogRead(Eje_y)/2);
  • delay(25);*
    }

(I use this tutorial: https://www.instructables.com/id/Arduino-LeonardoMicro-as-Game-ControllerJoystick/)

I use two potentiometers to simulate an X and Y Axis, the problem is that, although the Axis_y works well, the Axis_x moves the Joystick Diagonally, so, although the potentiometers are well detected, I still cannot occupy the Axis_x correctly.