I'm currently working on a project for my last semester of school. Currently, I'm on a co-op work term and haven't practiced much with my Arduino for a couple years go. So my problem is probably fairly simple to solve but I can't seem to figure it out. I have a If/Else If statement that should output the value of the duty cycle (of a fan), depending on the temperature output of a thermistor. I tried to use a nested if statement but it doesn't work like I want. Also, the variable "Enable" is the pin out
I declared for the Arduino to use, it's connected to the EN pin of a motor drive IC. Also, I'm measuring across the DC motor and I'm not getting any readings but I should be able to figure that part out. Any help would be much appreciated. The code is as follows...
Similar issue further down too. Of course you don't actually need the >=25 bit anyway - the evaluation of the first if already established that the temp is not less than 25
if ((TempCelsius>=35) && (TempCelsius<50));
{
analogWrite(E1,125);
Serial.println("Fanspeed = 60%");
}
if (TempCelsius>50)
{
analogWrite(E1,255);
Serial.println("Fanspeed = 100%");
}
i changed it up a bit just to make it as basic as possible. I still get the Fanspeed = 60% reading even when i'm not within that range. Also im printing the actual temperature onto the serial monitor to make sure that its not a hardware issue. Any help would be much appreciated.
if ((TempCelsius>=35) && (TempCelsius<50));
{
analogWrite(E1,125);
Serial.println("Fanspeed = 60%");
}
if (TempCelsius>50)
{
analogWrite(E1,255);
Serial.println("Fanspeed = 100%");
}
i changed it up a bit just to make it as basic as possible. I still get the Fanspeed = 60% reading even when i'm not within that range. Also im printing the actual temperature onto the serial monitor to make sure that its not a hardware issue. Any help would be much appreciated.
What if TempCelsius == 50, what then, nothing happens?