temperature control using fan,light bulb and DHT11

hi everyone,
i am having trouble with my codes. i’m using a dht 11 to read temperature and i just need to put a condition of if and else.
if the temperature is more than 30, the fan switch on or if the temperature is less than 30 the light switch on.
I’ve already done the codes but it is not doing switching from if to else. can you please help…thanks
please find the code below

#include <dht.h> //dht library
dht DHT;
#define DHT11_PIN 8

// Initialisation des ports
const int pinAna = A0;
const int pinFan = 11;
const int pinLight = 12;
int Temperature = DHT.temperature;
int limit = 24;

void setup() {
// communication speed

//initialisation of the outputs
digitalWrite(pinFan,HIGH);//to ensure the fan is off

digitalWrite(pinLight,HIGH);//to ensure the light is off

void loop() {

float temperature;
int Temperature = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");


if(Temperature <= (limit)) //temperature less than assigned
digitalWrite(pinLight,HIGH); // Light on
digitalWrite(pinFan,LOW); // Fan off
Serial.println(“Low Temperature”);

else if (Temperature >= (limit)) //temperature greater than assigned
digitalWrite(pinLight,LOW); // Light off
digitalWrite(pinFan,HIGH); // Fan on
Serial.println(“High Temperature”);




Start with the basics. What do your Serial.print()s show? Do you see the correct temp printed in either the first or second prints, which are printing different variables?

Where did you get the dht.h library that you're using? You seem to have the DHT11 connected to a digital pin which is not what I'd expect.