Noob question coming up...
I have connected a digital output pin on my Arduino board to the base of an NPN transistor (BD135). There is a 9v battery connected between the collector and emitter, along with a resistor and LED. The Arduino simply switches pin 6 on for a few seconds (sending 5v) then off for a few seconds and repeats. I have noticed that when using a lK Ohm resistor that even if the 9v battery is not attached that the LED will still light up (though not quite so bright). I thought that the transistor was a switch and I don't understand why power is getting from the base to the LED; I'd be most grateful if someone could explain what is happening!
If I swap the 1k resistor for a 47k resistor then the LED only lights when the 9v battery is attached.
[EDIT] I've noticed that if I put the LED and resistor on the collector side that it only lights when connected to the 9v battery (even using the 1k resistor on the base side)... is this how transistors should be used?