Trouble Reading Analogue Input

Hi Everyone, I am having some problems reading an analog input 0-5v from a motorcycle gear position sensor with my arduino. when i check the voltage going into the analog pin on the arduino (with a voltmeter) it reads the correct value, 0 to 4.6v depending on the gear of the engine. however, the arduino is always reading 0 from the analog pin and i can't figure out why that is. any help would be very much appreciated.

Here is a wiring diagram that shows how i have it hooked up. The two resistors at the top of the image represent the Gear position sensor.

Thank you.

Check the continuity on the ground. Specifically when you measure the voltage going in to the arduino you put one probe on the arduino input, where do you put the other? Check that there is a path between the place of the other voltage probe and the arduino ground.

Then post the sketch because it might be that you are doing something wrong in software.

When checking the voltage we are checking it by intercepting the wire going into analog pin 5 (our analog input) and the ground from the voltmeter is going directly to battery ground. the path is continuous from the arduino ground to the battery ground.

to check the analog input we are just using the smoothing code from the example included with the ardunio ide. but i will post it anyway.

const int numReadings = 10;

int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

int inputPin = 5;

void setup()
{
  // initialize serial communication with computer:
  Serial.begin(9600);                   
  // initialize all the readings to 0: 
  for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;          
}

void loop() {
  // subtract the last reading:
  total= total - readings[index];         
  // read from the sensor:  
  readings[index] = analogRead(inputPin); 
  // add the reading to the total:
  total= total + readings[index];       
  // advance to the next position in the array:  
  index = index + 1;                    

  // if we're at the end of the array...
  if (index >= numReadings)              
    // ...wrap around to the beginning: 
    index = 0;                           

  // calculate the average:
  average = total / numReadings;         
  // send it to the computer (as ASCII digits) 
  Serial.println(average, DEC);               
}

That code looks OK but I would simply read the pin and print it out. Why make it complex when you have something fundimentally wrong to track down.

What you say you have done to wire it up also sounds right but as you are getting nothing out then either you have not implemented what you think you have or your arduino input pin is damaged. Try using the other analogue input pins just to make sure.

What is the purpose of 'R2' in this circuit? Couldn't 'R1' be chosen such that you wouldn't need 'R2'?