scjurgen, thank you so much for your helpful debugging tips. It reads 1023 when I connect the pin to power and 0 when I connect it to ground. I also tried a different analog pin. I even tried snipping off the edge of the wire a bit (it's the stranded kind, so it tends to split easily). I revised my program so that it looks like this:
int analogPin = 4; // potentiometer wiper (middle terminal) connected to analog pin 3
// outside leads to ground and +5V
int val = 0; // variable to store the value read
void setup()
{
Serial.begin(9600); // setup serial
}
void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
delay(500);
}
Still, no results…

I'm wondering if it's a problem with the sensor itself.