nkuck, I would suggest a static offset to correct things. Say your sensor reading is off by 10F, just add 10 to the Ssensor variable. With the current way you're doing it, it may read normal at the temperatures you're reading, but as you get farther from those temperatures your readings will get farther and farther off.
Here is what I would do:
Code:
// read sensor inputs, convert to degrees, and assign to variables
Counter = 0;
while(Counter < SensorReadings) {
Ssensor += analogRead(SsensorPin) / 2;
Tsensor += analogRead(TsensorPin) / 2;
Counter++;
digitalWrite(ledPin, HIGH);
Delay(250);
digitalWrite(ledPin, LOW);
Delay(250);
}
// calculate average temp from sensor inputs
Ssensor = Ssensor / SensorReadings;
Tsensor = Tsensor / SensorReadings;
// calibrate sensors
Ssensor = Ssensor + 10;
Tsensor = Tsensor + 13;
This is just an example. Replace the 10 and 13 with whatever the readings seem to be off by. This will create a linear offset that won't drift as the temperature varies.