I am making an auto adjusting fan and I am having trouble creating a code. please help.
See attatched code.
sketch_apr04a.ino (4.31 KB)
I am making an auto adjusting fan and I am having trouble creating a code. please help.
See attatched code.
sketch_apr04a.ino (4.31 KB)
See attatched code.
Why isn't it posted?
Possibly some closing } missing
And == does not belong in fanSpeed = 0; ==
Might be more wrong but that is what I picked up.
int tempMin = 18.333; // Minimum temperature to start the fan in celcius
int tempMax = 26.667; // Maximum temperature to turn fan at 100% speed
Clueless about what int means, I see.
if(tempMax> temp > tempMin) { // if temperature is inbetween min and max temp
That is NOT how to check that a value is in a range. There are NO shortcuts.
IRrecv irrecv(remote);
decode_results results;
{
void dump(decode_results *results)}
float t = dht.readTemperature(); //take temp reading from sensor
float tf = (t*1.8)+32; //convert Celcius to Farenheit
}
No one else is allowed to define a function inside a function. What makes you special? Nothing.
PaulS:
int tempMin = 18.333; // Minimum temperature to start the fan in celcius
int tempMax = 26.667; // Maximum temperature to turn fan at 100% speed
Clueless about what int means, I see.
if(tempMax> temp > tempMin) { // if temperature is inbetween min and max temp
That is NOT how to check that a value is in a range. There are NO shortcuts.
IRrecv irrecv(remote);
decode_results results;
{
void dump(decode_results results)}
float t = dht.readTemperature(); //take temp reading from sensor
float tf = (t1.8)+32; //convert Celcius to Farenheit
}
No one else is allowed to define a function inside a function. What makes you special? Nothing.
How would I check if a value is within the range, then? Also, what do you mean by a "function inside a function."
Take your code, put it back into the IDE and then press Ctrl-T. This will reformat your code to a common C style and may help you answer your own questions.
jake896:
How would I check if a value is within the range, then?
You already use correct range checking here
else if(t>=26 && t<29){