Arduino cant give power to an LED

I was doing a project with TSOP, a 12v fan, LED, and a buzzer all taking power from ardunio. Yes, i agree it drew way too much current than arduino could provide. The project was to activate the fan, led or buzzer by pressing the remote control of my tv. Since only one of them was activated at once, i was not worried. The fan was spinning but only at a low speed. LED was lighting up well as well coz when i turn on LED, the fan stops. All according to the plan. I am using IRremote library. After some time, only one of the components were working properly. If the first component is fan, then it will spin as usual, but the second component, LED will only light up a little. I found out that current to LED is very low. I think my arduino is destroyed. Help please. Here is my code too, see if anythings wrong

/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.h>

int RECV_PIN = 11;
int ledPin = 5;
int fan=8;
IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{pinMode(ledPin,OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  digitalWrite(ledPin,LOW);
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  if(results.value ==2)
    digitalWrite(ledPin,HIGH);
    else
    digitalWrite(ledPin,LOW);

  if(results.value ==1){
    digitalWrite(fan,HIGH);
    delay(500);
    digitalWrite(fan,LOW);
 
  }
  }

Please post your schematic/wiring as well.

You're missing this statement for the fan pin:

pinMode(ledPin,OUTPUT);

Am surprised it ever turned on; writing the pin hi/lo here

    digitalWrite(fan,HIGH);
    delay(500);
    digitalWrite(fan,LOW);

only enables/disables the internal pullup resistor.

I don't see anything that talks about a buzzer.

THanks, corrected the errors abt the code, some more problems remaining

CrossRoads:
Please post your schematic/wiring as well.

You're missing this statement for the fan pin:

pinMode(ledPin,OUTPUT);

Am surprised it ever turned on; writing the pin hi/lo here

    digitalWrite(fan,HIGH);

delay(500);
    digitalWrite(fan,LOW);



only enables/disables the internal pullup resistor.

I don't see anything that talks about a buzzer.

With today's more efficient LEDs even the small amount of current that the input pin internal pull-up resistor can provide will be seen in most leds as he enables and disables the pull-up in the sketch. Try it sometime.

Hey, that was an error :stuck_out_tongue: Can any one help me why the serial number thats received from my remote shows "1", "801" "FFFFFFF" for the same button i press?

I would try clearing results.value after you use them, so they are not holding the same value during the next pass thru loop. And add some { }s

  if(results.value ==2){
    digitalWrite(ledPin,HIGH);
results.value = 0;
}
    else{
    digitalWrite(ledPin,LOW);
}

  if(results.value ==1){
    digitalWrite(fan,HIGH);
    delay(500);
    digitalWrite(fan,LOW);
results.value = 0;
  }
results.value = 0; // bad result received
} // end loop

AyushChand:
Hey, that was an error :stuck_out_tongue: Can any one help me why the serial number thats received from my remote shows "1", "801" "FFFFFFF" for the same button i press?

FFFFFFFF is the repeat code for a lot of remotes. If you press the same button twice within a short amount of time, or hold it down, the first code it sends is the actual key code, followed by one or more FFFFFFFF codes.

The fact the first code can differ could be down to improper reception or interference.

Alternating 0x0001 and 0x0801 is normal for lots of Remotes (of mine, at least), to distinguish two presses of the the same button from a longer press of the same button.