What I want to know is that how exactly does analogRead work because I have want to use it with a flex sensor and it has only two pins.I tried to find other examples on the internet, but this is the only example I find.If the middle pin of the 10k potentiometer and a0 pin are shorted or the gnd pin is removed altogether,then would this thing work?

  • You did not show us the example which is confusing you.
    – st2000
    May 24, 2017 at 7:03
  • I moved this to the answer...
    – st2000
    May 24, 2017 at 7:06

1 Answer 1


I think you are confused because the ADC input measures voltage, not resistance.

To convert from resistance to voltage you need to pull in the opposite direction on the variable resistance with a fixed resistor. As in the following image from this tutorial.

enter image description here

  • Hmmm...the image said it all....thank you...
    – nalostta
    May 24, 2017 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.