AnalogRead won't work properly

When ground is gone from the potensiometer its max (1023) but when ground it connected to the middle pin it goes down to min (0)

have no idea whats causing it

#include <Servo.h>
Servo ESC;    
int potValue;  
void setup() {
  pinMode(13, INPUT);
  ESC.attach(3,1000,2000); 
Serial.begin(9600);
}
void loop() {
  if(digitalRead(13) == HIGH)  { 
 int potValue = analogRead(A5);
  potValue = map(potValue, 0, 1032, 0 , 130);
  ESC.write(potValue);
  Serial.println(potValue);
  }
}

How exactly is the pot wired ?

Pin 13 may not be the best choice for an input pin because it is used with the built in LED on many Arduinos

pin 13 works as a enable points it works perfectly fine, I'm talking about the AnalogPin (A5)

Did you mean 1023?

Pretty unlikely.

Can you describe your problem in a little more detail,please?

yes

anyone here

You wired, most likely, the pot incorrectly. Post an image of your project all wired up and ready to go.

Next, notice there have been a request for additional info?

Post#2 has an important question that needs answering; most likely the poster is waiting for an answer. Post#5 has an important question that should be answered; most likely the poster is waiting on an answer.

oh i should prolly take a picture then ok wait a sec ill show all the wiring logic after the picture



Can't see the pot connections. Wires are blocking the view.

wait a sec im wrting the connections rn

Drawing, not writing, I hope...

about that...

IMAGE 1:
a. AudioJacks
Very Bottom Pins 5V+
Middle Pin Analog Right A5 - Left A0
Upmostpin Digital Pin Most Right D13 - Left 2 (All pins used here are NON PWM pins

b. Breadboard Sockets
Right Rockets All Grounds
Left Sockets PWM Left most pin 11 - Most Right pin 3 (All pins are PWM in order like the previous one)

IMAGE 2:
Audio Jacks: same connections
POT: Right Pin 5v
Middle pin Analog Output
Left GND
Switch: Middle 5v
Right Digital Output
led is just connected to the output oftheswitch
The arduino it just filled with wire

sorry for not drawing a diagram I don't have any schematic drawings

Unacceptable. You can use pen and paper, take a photo and upload. It should include the entire system...

ok makes sense
il do it imma grab paper brb

Actually, you should have schematics drawn before you even start wiring.

my wiring is a paper writen of what the jacks do like right most jack is 5v a5 then d13 that rly it but imma draw a scem rn

Please post in English.