Hello! I'm new to programming, so my skills mainly include looking up commands and editing existing code. I have a code that should print the current temperature in F to the console, and if the temperature goes over 75 degrees it will activate a case fan. This all works well, but when the temperature goes below 75, the fan doesn't stop. Here is my code, as messy as it is.. :p If anyone can help out by fixing the code and/or telling me how I majorly screwed up, that would be seriously appreciated. Thanks!

1. When you post code, post using the CODE tags. You should have read that when you were reading the Read this before posting a programming question thread at the top of the forums.2. In order for the fan to turn off, you have to tell it to turn off. You never do, you only tell it to turn on if it goes over 75, but not to turn back off if it goes below it.

Also, it is common in situations like this to add hysteresis (en.wikipedia.org/wiki/Hysteresis) and make the "turn off" temp lower than the "turn on" temp to keep the fan from turning on and off too quickly.

When you apply Patduino's fix though, consider putting it in the loop routine or changing the name of printTemp. It's a bit counterintuitive, given its name, to find the fan controller code in a routine called printTemp.