Potentiometer/code error

Attempting to make a simple code that gives the Voltage(V) of leg3 on my potentiometer (POT) (just a beginner ). However, when the POT reads near its min (0.1 ohm), my serial monitor reads 522 and at its max (10k), 1023. But, moving the pot from 0% to 85% of its range, returns 522 - 585, then instantly starts climbing to 1023 (586 -1023) for the remainder of its %.
Nothing is wrong with the breadboard or POT. Even tried using diff gnd pins, and A# pins. I put in the the code I used but I've already recoded it a few times. Does anyone know how to fix this situation or possibly explain what I'm doing wrong, it'd be greatly appreciated!

int readPin=A3;
float leg1=0;

void setup() {
Serial.begin(9600);
}

void loop() {
leg1=analogRead(readPin);
Serial.println(leg1);
delay(100);
} 

Welcome to the forum

Seeing a schematic of your setup would help

Is it a linear pot or a logarithmic pot ?

Please explain why you say that. You said you are a beginner (or at least I think that's what you meant to say, because I have never heard of a beginner pot).

Have you tried a different pot? Or a different breadboard? Or at least a different part of the breadboard.

Even though you haven't shared details of your wiring, I can immediately imagine a likely cause. You are using a breadboard with a non-breadboard-compatlble Arduino, a Mega. That forces you use use Dupont cables, and these are notorious for their unreliability. Have you tried testing out at least replacing each one you are using?

Does the breadboard have continuous power strips along its edges or do they have gaps in the middle ? If the latter then have you got connections to each side of the break ?

Serial.println(leg1);

but your code says leg1

What kind of pot, linear, log?

Sounds like you have a "volume control" pot with a logarithmic taper that more closely matches the non linear response curve of human hearing, a type "A" pot. Look at the back of the pot and post the lettering there (if any).

What are the characteristics of a linear pot versus log pot, that @anon789456 can observe on the DMM?

At one end of the track a small movement of the pot wiper will produce a small change in resistance whilst at the other end of the track the same size of movement will produce a much larger change in resistance

Is this observable with a DMM? (no graphic output)

Log or linear, it shouldn't start from 522..

Not nearly as easily.

  • Set the potentiometer to it's mid position.
  • Measure the resistance between the wiper and each end.
  • For a linear potentiometer the two values should be similar.
  • For a logarithmic potentiometer, one value should be about ten times the other.

Describing pot-turns-versus output might help @anon789456
Mark five spots along the pot dial and map them...

        1  2  3  4  5  6
Linpot  0  1  2  3  4  full
Logpot  0  1  1  3  5  full

Yeah, I counted that as graphic output, albeit paper and pencil.

I don't know how the pins of you potentiometer are numbered, but I would have thought that the wiper would normally be designated as pin2.

The wiper is the one that I would have connected to the Arduino analogue input.