Potentiometer not working properly?

I wired it up, one outside pin to +5v, the other outside pin to ground and the middle pin to an analog input. Im just trying to read the values from the potentiometer, I tried changing the code and copying and pasting the code so thats not the problem. (I'm new to electronics not programming). The potentiometer is just reading random values, and when i put my hand near it they change a lot more. Changing the dial barely does anything, the values are always just changing. So is the potentiometer broken?

Tell us the potentiometer value (between the outsides pins).
Show us the code.

it says B50K at the top, nothing else.

int potPin=A0;

void setup()

void loop()

What happens when you short the input pin to +5V?
To gnd?

ok the potentiometer is working now.. it just randomly started working. But I was wiring a switch on as well, which I have done before and did exactly the same way. When I plugged in the arduino to my computer the orange light comes on the fades away really fast and stays off and it cant find the correct serial port. When I plug in the battery pack the orange light will come on but the I still cant find the right serial port to upload any sketches. Is something possibly wrong with the arduino?

Is there anything connected to the Arduino? Disconnect ALL wires and try again.