you should probably start the test with > 70, else test with >60 else go for the default
if (temp > 70) {
// what to do if it's more than 70
...
} else if (temp > 60) {
// what to do if T° is between ]60, 70]
...
} else {
// what to do if you are below or equal to 60
...
}
When writing code try and read it like the microcontroller would. In loop that means 1 line at a time and then back to start. When writing a conditional statement do a calculation in your head as to whether it will be true or not. You have multiple conditional statements that will run true at the same time.
Either use the if else structure advised above or use a switch case. You are getting close. It is also wise to work on each component and the simplest block of code at any one time. Don’t over complicate. Often a single block of code can be tidied up into a function. You start progressing towards OOP (object oriented programming) which becomes easier to read, recycle and tweek to suit any new projects
You are missing an 'else' between the first 'if' and the second 'if'. The second 'if' will be performed regardless of the first 'if' and will either turn all the fans on or all the fans off. That overrides whatever the first 'if' did.
You should give the pin numbers names and use the names to make the code easier to understand:
Solar energy heats the air in the greenhouse. If the air inside the greenhouse gets too hot, blow the hot air out, causing cooler air to come in from outside. (The outside air is presumed cooler because it is not subject to the "greenhouse effect" (visible light being converted to infrared radiation that then gets trapped inside the greenhouse by reflecting off the glass).
80f is 26 celsius, this is normal for summer, it can get 35 like this summer, what then? I’m asking this because I have a feeling OP might think that because you could cool down a person with a fan it is the same for green house
Our greenhouse got significantly above air temp even with the doors open, some crops won't ripen if it's too hot. Tomato's won't ripen if it's too warm.
We are hoping the fans will help lower the temperature of the greenhouse.