I recently installed raspbian on my RPi and i have experience in Python so I decided to play with GPIO pins. As soon as i connected my led to the 4th pin(5V) and 5th pin(GND) it turned on and I couldn't stop it. That happens on the other pins too. How do i turn this off?

  • Probably by using the correct pins. What are the 4th and 5th pins. Have a look at the table at the end of abyz.co.uk/rpi/pigpio. Which pins are you actually using?
    – joan
    Jan 24 '16 at 14:39
  • I can't find anything there for RPi B+ Jan 24 '16 at 14:41
  • Last table, 40 pin expansion header. Note, you need a series resistor with a LED or it might burn out.
    – joan
    Jan 24 '16 at 14:46
  • I am using pins 4 and 6 just like I said Jan 24 '16 at 14:48
  • 2
    No you didn't, you said 4th pin and 5th pin. If you connect to 5V and ground the LED will stay on. If you want to switch the LED connect it to a GPIO and ground. Then switch the GPIO on and off.
    – joan
    Jan 24 '16 at 14:52

It seems you are connecting your LED to a power supply and ground, what else should it do but light up (or burn, without a resistor)? In other words, you are not using any GPIO actually.

To be able to control when it goes on you will need to connect to an actual GPIO and then ground or power. You can then control the LED by setting the GPIO you use to high or low respectively. Note that you need at least one resistor (to protect the LED), but probably should use more to provide some protection against using it wrong (which might burn your hardware!). Refer to the various available how-tos on this. An example I like (with good follow-ups) is http://raspberrypi.powersbrewery.com/project-1-a-simple-led/ ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.