Joystick axis value problem

I'm trying to make a DIY flight controller and when I started programming the joystick I came across this weird problem where the axis readings decreases both ways of my joystick I mapped the values 0 to 255 if I move the joystick up the value decreases to 0 and It's the same if I move it down, it seems to be centered at 255 and decreases both ways, It's supposed to get to 255 at the max top and 0 at max down. Also I'm using a leonardo and It seems to be acting normal on arduino UNO but For the flight controller I need to use the leonardo.`

void setup() {
// put your setup code here, to run once:
digitalWrite(A4, HIGH);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.begin(9600);
Serial.print(analogRead(A4));
Serial.print("\n");
}`

Btw this is just a test code where I test the values It gaves the same results as the main code.

We can't see your code.

remove the digitalWrite(A4,HIGH); and post the results.

This enables the internal pullup resistor! and changes what it reads from your joystick.

Okay that solved my problem thank you.