added interrupt-based thermostat code