Hi

While cooling down a substance i will meassure the temperature with a DS18B20 sensor and i would like to use this data for calculating the slope coefficient.

If, lets say, i meassure the temperature every 10th second, and the change in temperature is -0,5 degrees C (+/- 5%) 5 times in a row, the slope coefficient is -0,5.

The cooling curve is expected to be quite linear.

So what i need is basically the ability to save the current temperature, wait 10 seconds and compare the new temperature with the old one.

This gives us some kind of figure for the deviation in temperature.

Also this deviation is saved and 10 seconds later compared to the new deviation.

If the two values for deviation are the same (plus or minus my tollerance of 5%), a counter should count one up.

If the values are not the same, the counters value should be reset.

Once the counter has counted to 5, the latest value for deviation (they should almost be identical) should be available for printing to a LCD or similar.

I am open to any good ideas. Perhaps there's even a library that can help me on the way, but i haven't found it yet.