Calculating Unknown Resistor with Arduino

you should be using

  • EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.

and make sure your external power is not more than 5 volts