I'm currently having some trouble getting by raspberry pi to work with a NPN transistor. All I am trying to do is turn an L.E.D. (which has a forward voltage of 3V) on from an external battery and have my Pi control when to allow the battery current to flow through the L.E.D. via transistor. Here's my problem: I can't get the Pi to turn the transistor into the "off" state to turn off the L.E.D. I know my code is working properly, as I made a circuit without the transistor, but I can't get the darn L.E.D. to turn off with the transistor in the circuit. Here's my circuit:
- Code: Select all
import RPi.GPIO as gpio
I have tried several other GPIO pins but I still can't get the L.E.D. to turn off. The weird part is that if I replace pin 8 in my circuit with the ground pin, the L.E.D. will still stay on! If I completely unplug the Pi from the circuit, the L.E.D. is off. Do the pins on the Raspberry Pi constantly give off a small amount of current constantly or something? Please help me as I have tried several hours to figure this out to no avail.