IR sensor reading not displaying

Hi, all,

I'm new here. I read the sticky posts. I am a huge newbie to both building and programming. Please feel free to correct me if I'm doing this post wrong.

What I'm trying to do:

Test IR distance sensors. These sensors (all Sharp; mostly GP2Dxxx) will eventually go in a mini sumo robot, but right now, I just want to make sure they work, and test the readings at different distances from a target object.

What I've done:

  1. Tested my Arduino board to make sure it was working. New board. Uploaded Blink. It worked.
  2. Connected sensor to board using diagram from sensor specs: http://www.sharpsma.com/webfm_send/1205 (that is, connected to ground, 5V, and an analog pin -- tried 9, 10, and 11)
  3. Ran the program below and got all readings around 300, varying by a little
  4. Moved target objects around for a while and readings all stayed the same, no matter what pin I was hooked up to
  5. Went to my dad, the robotics professor, and asked him what's going on. He hooked up a potentiometer and I wish I could remember exactly what made him say this, but he said he thought there was probably an issue with my board, because he could see I was making a connection.
  6. Tried the same setup with multiple Arduino boards (extras he had lying around) and multiple sensors (ditto) and got the same result. Figured maybe the code's just wrong, unless it's true that all five Arduinos are b0rked.

The code:

  int IR_SENSOR1 = 9; 
  int IR_SENSOR2 = 10; 
  int IR_SENSOR3 = 11;
  int irV1 = 0; 
  int irV2 = 0;
  int irV3 = 0;
  
  void setup() {
  Serial.begin(9600);
  pinMode(9,INPUT);
  pinMode(10,INPUT);
  pinMode(11,INPUT);
 }

void loop() {
  // put your main code here, to run repeatedly:
  // read the value from the ir sensors 
  irV1 = analogRead(IR_SENSOR1); 
  irV2 = analogRead(IR_SENSOR2); 
  irV3 = analogRead (IR_SENSOR3);
  Serial.println("Here are your sensor readings"); 
  Serial.println(irV1); 
  Serial.println(irV2); 
  Serial.println(irV3);
  delay(500); 
}

The way it looked to me was something like this:

Here are your sensor readings
293
300
295
Here are your sensor readings
300
302
294

and so on.

Can you give me some idea of what to try next?

(that is, connected to ground, 5V, and an analog pin -- tried 9, 10, and 11)

On which board? The Uno and other 328-based Arduinos only have 6 analog pins.

that is, connected to ground, 5V, and an analog pin -- tried 9, 10, and 11

None of which are analogue input pins on most, possibly any, Arduino.

UKHeliBob:
None of which are analogue input pins on most, possibly any, Arduino.

The Mega and the Due have that many analog pins.

I await with interest to hear which Arduino the OP is using