attachInterrupt without external input?

I am going to control a fridge compressor with a temperature sensor and would like to add some sort of delay to protect the compressor from starting too soon after being switched off. In order to do this I thought I could monitor the pin I use to control the solid state relay and when it goes from HIGH to LOW (falling), start some kind of delay code, perhaps adding 1 to a variable until it reaches a pre-determined value. Anyway, http://arduino.cc/en/Reference/attachInterrupt only describes external inputs, but isn't there anyway of monitoring an output instead?

Just read it - the compressor is not going to immediately fire up the nanosecond it is commanded to, mechanical parts taking some time to spin, get up to speed etc. So use millis() to record when it was turned off, and if enough time has elapsed, allow it to turn on.

void loop(){
if (digitalRead(offSwitch) == LOW){ // something turned the compressor off
offTime = millis();
}
currentTime = millis();
if ((digitalRead(offSwitch) == HIGH) && ( (currentTime - offTime) >= minOffDuration) ){
// turn compressor on
}

Make sense? All time elements are unsigned long data type. The compressor will only be off for like hours at time kind of spans, or less, so (current time) minus (earlier time) will always yield a valid result.

The easy way with a fridge is to turn on the compressor when the temp goes above a value and trun it off when the temp drops bellow a SECOND value.

Mark

holmes4: The easy way with a fridge is to turn on the compressor when the temp goes above a value and trun it off when the temp drops bellow a SECOND value.

Mark

There is a slight risk of opening the door the second the compressor switches off and then triggering the "ON-temperature" resulting in the compressor starting just a few seconds after it was switched off. Yes, the chance is slim, but since it's only code I would like to protect the compressor as much as I can.

Make the gap between the low values big enough and place the temp sensor in the right place. How do you think the non micro controller fridges worked.

Mark