if function issue

Danois90:
You have some "if(stock >= t)" statements, they should probably have been the other way around:

if (temperature >= threshold)

{
  turnFanOn();
}
else
{
  turnFanOff();
}

Thanks, this fixed it!