dht11 and fan

When i connect the dht11 sensor to arduino, it work very well but if i want to control a fan or led with the temperature variations the led or fan will be at low power, low light... how can i fix it?

Hi, welcome to the forum.

Have you read this : http://forum.arduino.cc/index.php/topic,148850.0.html

Without knowing how you have connected the led or fan, and without knowing your sketch, we have to guess what is wrong.

i connect a sensor dht11 on the board and i would connect a fan or led to control when the temperature increase for example...., but when i do it, the fan dont work, but if i connect the fan unless the dht11 connected to a board the fan work very well, with the led too, but the led work so so, low light emitted

dht11_test.ino (1.28 KB)

sorry i have sent a wrong sketch, this is good
//
// FILE: dht11_test1.pde
// PURPOSE: DHT11 library test sketch for Arduino
//
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN A0
int x = 0;
int led1= 8;
int fan =9;

void setup(){
pinMode (led1, OUTPUT);
pinMode (fan, OUTPUT);

Serial.begin(9600);
Serial.println("DHT TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT11LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}

void loop(){
int chk;
Serial.print("DHT11, \t");
chk = DHT.read(DHT11_PIN); // READ DATA

switch (chk){
case DHTLIB_OK:
Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}

// DISPLAT DATA
Serial.print(DHT.humidity,1);
Serial.print(",\t");
Serial.println(DHT.temperature,1);

if (DHT.temperature<29)
digitalWrite (fan, HIGH);
else
digitalWrite (fan, LOW);

// CREPUSCOLARE

x= analogRead (A5);
if (x>510)
{
digitalWrite (led1, HIGH);

}
else
{
digitalWrite (led1, LOW);

}
delay(1000);
}

i fix it, i didnt remember the pinMode set to OUTPUT for fan o led, now work :wink: closed thankz