AnalogRead only giving 0 or 1023

Hi all,

I'm running into an issue where my analogRead won't operate as expected. My setup is an ItsyBitsy 5V in which I'm outputting an analog signal and trying to read it with another pin to verify and set up a feedback controller. The output is operating correctly as verified by multimeter, however the input is acting more like a digitalRead.

I've tried pulling down the voltage with a 10k resistor, removing/adding a "pinMode(A0,INPUT)," playing with all different arrangements of pins, and grounding all unused pins but nothing thus far has worked. Just reading a pin with no input is giving me values in the range of 250 +/-10, if that's any help.

Thanks!

An Analog read only gives you 0 - 1023 .

AnalogWrite() isn't very well named- it doesn't actually output an analog voltage. Instead it switches the pin on and off very quickly. The longer the on time, the higher the apparent voltage. The multimeter averages a couple of readings and that's why it appears correct but when you use analogRead you're either seeing the pin at its HIGH or LOW state.

This is how the analogWrite function works:- PWM