Calculate Resistance Using Audrino

You seem to be making a meal out of reading an analog pin voltage - why not simply:

#define Vsupply 3.3  // or whatever it needs to be
#define R0 10000.0   // name your constants at top level, don't sprinkle throughout the code
#define RESISTOR_PIN A0
float read_resistor ()
{
  float Vpin = analogRead(RESISTOR_PIN) * Vsupply / 1024 ;  // one line, simple to read
  return R0 * (Vsupply - Vpin) / Vpin ;    // simply clear calculation using voltage ratio
}

(Which would work if no other resistors on the pin)