It looks like you have tried quite a few things. Good for you. The one that would work easiest for me would be elapsedTime. You just need to make sure you calculate the elapsed time correctly.
Elapsed time is always going to be the difference between two time stamps. But it looks like what you want is the total elapsed time, which is going to be the sum of all the elapsed times that the temperature was too high. Furthermore, you want to display the total elapsed time up to now, regardless of the current temperature. Which means you have to calculate the total elapsed time while it still being increased. There are a couple of ways to do this, but I recommend the following: This is a loose algorithm. Adjust it to make it work.
boolean tempWasTooHigh = false;
unsigned long timeStamp;
unsigned long now;
unsigned long elapsedTime;
unsigned long totalElapsedTime = 0L;
void loop()
{
if (tempWasTooHigh)
{
now = millis();
elapsedTime = now - timeStamp;
totalElapsedTime += elapsedTime;
timeStamp = now;
}
ds18process(); // Get the current temp
FreezeTemp=tempraw[1]/16.0*1.8+32.0; // Convert raw to F
if (FreezeTemp < 76) // or whatever the threshold is
{
tempWasTooHigh = false;
// deal with LEDs here.
}
else
{
if (tempWasTooHigh == false)
timeStamp = millis();
tempWasTooHigh = true;
// deal with LEDs here.
}
DisplayResult();
}
Notice that once you have calculated the elapsed time and added it to the total elapsed time, you reset the time stamp. You don't have to keep the old time stamp around, because you have already dealt with that time and calculated whether the temp was too high or not for that interval.
In your DisplayResult() function, just display the totalElapsedTime. Don't mess with the time stamps there because they have already been handled.
You will need to add additional variables to handle the other two freezers, of course, and figure out how to display them on the displays.
Two other things you should be aware of -- part of this statement is useless:
if(FreezeTemp <=70 || FreezeTemp < 76){digitalWrite (BlueFreeze, LOW);}
else if (FreezeTemp >76){digitalWrite (BlueFreeze, HIGH);} //At the high(Blue) limit Blue LED = OFF
The || operator is a logical OR operator. You can be assured that any time FreezeTemp is <= 70, it is also < 76, so the first part of that conditional is redundant.
What happens if FreezeTemp is exactly 76? It will fail both conditionals and do nothing.