philba wrote:the code is doing exactly what you are telling it to do. You might try using temp rather than temp1, though. Plus, assuming outputting a high turns the heater on, it looks like your code will turn the heater off when the temperature is low and on when it's high. Perhaps you want to think about your logic a bit more.
Plus, you should learn about hysteresis. Basically, turn the heater on when the temperature reaches a degree or two below the set point and turn it off when it' reaches the same amount above the set point. You could wind up cycling the heater fairly quickly otherwise. This means you have to take into account if the heater is on or off as well as the temperature.
Users browsing this forum: No registered users and 6 guests