Aquarium controller with a debounce on the temperature sensor

I should have pointed out two things:

(1) All variables having to do with time should be unsigned long [because that is what millis() returns].
(2) Only use subtraction. Addition will fail every 49 days or so when calculating time via millis(). Subtraction ALWAYS works.

aarg suggested using a count. This will work but you will have to figure out a good value for the count. Instead of a count, I suggested a time. This will work and does not require figuring out a count but might be a bit harder to think about. You choose.