The other day I was fooling around with my Arduino and discovered something that I'm not sure about. I was experimenting with the analogRead function. Here is my code...
int inputPin = 2;
int ledPin = 13;
int val = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(inputPin);
if (val > 900) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
When I touched the wire coming out of the Analog In pin #2, the LED (pin 13) turned on! I wasn't touching anything other connection on the board. I can't figure out why when you touch that pin, it gives a value usually above 900. Why? I did some research and I still can't figure out why.
Help would be greatly appreciated!

