Mutliple inputs

So I am working on a project currently where I need to analog read more then one pin. If I read one pin by itself and print the value out I get what I expect. But when I do two separate AnalogReads then one of the reads is completely off. By as much as 800. Here is the code that I am using.

#define SENSOR 0
#define POT 5

void setup()
{
 Serial.begin(9600);
 }
void loop()
{
  int val=analogRead(SENSOR);
  int music=analogRead(POT);
  Serial.println(val);
  Serial.println(music);
}

What I keep noticing happening is i am reading a potentiometer to be able to adjust my other input. What keeps happening is what should be the zero value on my SENSOR analog pin is half of my POT sensor.
Is my arduino broken. I do not want to jump to conclusions.

Just for grins why dont you put a delay(10) between the two analog read statements and see if that changes your symptoms.

Lefty

Nice thought lefty but still the same problem. Any other suggestions. Anyone. Please.

How do you connect your sensor? the pot?

I feel a little stupid but I have no idea on how to post a photo on this forum from my photos. I have found a picture online of how i did it.

I think is not your code or arduino, its an electrical misconnection or something like that, maybe you mixed gnd with the output of the pot, or something like this

Half the value from analog read is often what you get when the pin is not connected correctly. As eried says, check all of your connections.

Just for grins, see if this changes anything...

void loop()
{
Serial.println(analogRead(SENSOR));
Serial.println(analogRead(POT));
}

Eried I went throught and disconnected the entire board and then reattached it. Tested the code and still got the same response. I then moved on and jafadmin's code and got the same response. Finally I moved on to the magic voltmeter. This gave me some interesting output. I measured the SENSOR and got a consistent 0.04Volts no matter what position the pot is in. Then I looked at the pot output when changed the position the voltage changed aswell. Any clue. I am slowly coming to the conclusion it might be my board. Any other suggestions.

Have you tried other analog input pin?

It cannot be the board if when you have just only connected they work perfectly. Can you post some photo of your connections?

Yeah I have tried quite a few different combinations of the analog inputs and received the same response. The problem I have is a little stupid but I do not know how to post pictures from my computer with YaBB. The board just works fine with just one input but sucks with two.

I do not know how to post pictures from my computer with YaBB.

you can upload the picture(s) to one of the public sites like flickr and post links to them here.

I figured a way to post the picture with a flickr account but there should still be an easier way:

Nice clear picture, that helps a lot.

Try connecting the red wire from pin 0 to the same place as the wire going to pin 5. This will feed the same voltage to both pins. If you get the same readings then you know the problem is with the sensor. If the readings are different then try using a different analog pin.

Well this is a little weird. The two sensors, when hooked up to the same source, read the same exact value. Any ideas.

Check that you have one side of the variable resistor going to +5 volts (that looks like the red wire in your picture)

connect the center pin of the variable resistor to two analog pins (say 0 and 3) using two wires.

connect the other end of the variable resistor to GNd

disconnect everything else

you should see the similar readings on the two pins connected to the center pin of the variable resistor

So I completely disconnected everything, hooked up pins 0 and 3 to the center pin, outer two to 5V and Gnd respectively. The two pins register the same value.

that confirms that the pins and code are ok. Now try disconnecting one of the two wires going to the center of the variable resistor and connect it to the sensor. (you will also need to connect the sensor ground pin)

Alright I tried that and found some more symptoms of my problem. The SENSOR is hooked to a CD player that is off. When the CD player and the cord I have connecting it are plugged into the stereo jack the value registered is half. When it is not plugged in it is just a little less then the POT sensor is registering. I checked the SENSOR input with a voltmeter and it registered anywear between 0.01 and 0.04 Volts.

To see if the stereo input was the problem with my project I took it out and put in another potentiometer and monitored the same kind of odd output.