ADC Values Stuck at 1023 Arduino Pro

Hi,

I have what should be very simple code, and yet I seem to have an issue. the ADC value (as the subject suggests) is stuck at 1023. I’m running an Arduino Pro 5V 16 MHz. I’m changing the voltage with a multimeter, and yes, it is wired properly, I can see the analog voltage change on my multimeter, but not on the serial output. I’ve tried multiple ADC pins, I’ve tried setting sensorPin to 5 instead of A5, etc… and no dice.

int sensorPin = A5;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
int speed = 0;
#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
void setup() 
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
  Serial.begin(9600);
}

void loop() 
{
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  speed = map(sensorValue, 0, 1023, 83, 180);
  //figure out what values for spinning should be  
  myservo.write(speed); 
  Serial.println(sensorValue);  
}

I’m changing the voltage with a multimeter, and yes, it is wired properly, I can see the analog voltage change on my multimeter, but not on the serial outpup

Well, you don’t change voltage with a multimeter so I’ll assume that’s a typo. If you are getting the full 5V (3.3?) at the ADC then you have probably not wired it up correctly. Are you measuring with the multimeter at the input pin? If you are using a potentiometer, then one end should go to gnd, the other to the +V rail (3.3 or 5, what ever the arduino is using) and the wiper (middle terminal) should go to the analog pin on the arduino.

Also, when you have a problem like this, strip everything out of your code that doesn’t apply. I would have removed the servo stuff. Boil it down to the barest of essentials.