float Vo = 0;
float R1 = 10000;
float R2;
float T_Kelvin, T_Celsius;
float T_Fahrenheit;
float c1 = 1.009249522e-03;
float c2 = 2.378405444e-04;
float c3 = 2.019202697e-07;
void setup() {
Serial.begin(9600);
}
void loop() {
Vo = analogRead(A1);
R2 = R1 * ((1023.0 / Vo) - 1.0);
T_Kelvin = (1.0 / (c1 + c2*log(R2) + c3*log(R2)*log(R2)*log(R2)));
T_Celsius = T_Kelvin - 273.15;
T_Fahrenheit = (T_Celsius * 9.0)/ 5.0 + 32.0;
Serial.println("Resistance:");
Serial.println(R2);
Serial.print("Ohms");
Serial.println("Temperature: ");
Serial.print("T_Kelvin");
Serial.print("Kelvins");
Serial.println("Temperature: ");
Serial.print(T_Celsius);
Serial.print( "oC");
Serial.println("Temperature: ");
Serial.println(T_Fahrenheit);
Serial.print("oF");
delay(3000);
}