Arduino Uno - Analog Input: Random power readings.

Hello, I'm currently working with my arduino uno, and i noticed sections of my script triggering when I had not intended for them to be triggered, then i tracked the issue to my analog input.

the analog inputs A0 through A5 are all displaying absolutely random readings.

Here's my output:
292--286--296--0--0--81--272--442--439--642--668--739--779--804--739--578--485--405--348--282--276--283--280--0--70--131--160--260--362--45

and my code:

int x = A1;
void setup()
{
  pinMode(x,INPUT);
  Serial.begin(9600);
}

void loop()
{
  int var = analogRead(x);
  Serial.print(var);
  Serial.print("--");
  delay(500);
}

I used this code to test my theory of these random readings, and sure enough it was true.
This is an issue.
My trigger uses a the analog inputs to read the power from the 3.3V power source on the arduino.
Running this script, 671 is often printed, and that's causing my script to fire when i do not want it to.

Does anyone know why this is happening?

Note:
The A1 port is totally disconnected from anything, and i've even lifted the Arduino Uno in the air so it's suspended by it's cable to the computer, yet these random readings are still there.

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Floating Input. Completely expected. If you want it to default to a reading of 0 or 1023, you need a pulldown/pullup resistor, respectively.

I'm quite new to this, and I have not studied any of this in any sort of class. (I'm 16 also)

What's a pull-up/down resistor?

Is this a reliable page?

That's the general idea.

The A1 port is totally disconnected from anything ...

It therefore won't give a reading of zero, it will give an undefined reading.

Yes and lookup pull-downs too.... Most handy to be able to 'preset' inputs to known states... which is what it is all about, that and understanding when it is necessary and when not... A 'hint', better safe then sorry as you found out... start with 100 K and go as low as necessary to keep the open pin quiet or not reporting change that isn't there...

Bob

I got it working, thanks guys!

You've all helped me greatly.
My understanding of the arduino and circuits increased much.

Farewell for now!