I've been following basic tutorials on how to programmatically turn on leds from my Raspberry Pi 2. I'm using a breadboard, and I connect 3 leds, using a male-female jumper from the pins of the raspberry to the breadboard. I've been using the pins 7, 11 and 13 (GPIO 4, GPIO 17 and GPIO 27). Yesterday I got everything working as expected, code used is (shortened):

import RPi.GPIO as GPIO
GPIO.setup(17, GPIO.OUT)

Today I've been making some changes, and at the end wanted to return the same old configuration. Did everything as the tutorials said again, but now the led connected to pin 11 (GPIO17) is always on, doesn't matter the programmatical input.

Any ideas where I probably go wrong, or maybe some settings I need to change. Any ideas will be appreciated.

  • For a test : are you able to test a different pin - and see if the same thing happens ?
    – monojohnny
    Mar 11, 2015 at 12:39
  • I've tested pins GPIO 27 and GPIO 22 and everything works as expected. Same problem occurs on pins GPIO 2 and GPIO 3 Mar 11, 2015 at 12:59
  • gpios 2 and 3 have fixed 1k8 pull-ups to 3V3 and will always read back as 1 unless they are driven low. They may be used as I2C (which needs the pull-ups). What is connected to pin 11? Are you sure it's not connected to 3V3 rather than ground?
    – joan
    Mar 11, 2015 at 14:27
  • I have a jumper cable connected to pin 11, going to the breadboad, where is a led connected. After that a resistor and a another jumper cable going to Ground (pin 6). Mar 11, 2015 at 14:30
  • The code you show only switches the gpio high (True or 1). Could you confirm that it doesn't work when you switch the gpio low (False or 0)?
    – joan
    Mar 11, 2015 at 16:07

2 Answers 2


I had the same issue using an LED bar (8 LEDs with common VCC). I was setting the pins I wanted to turn on LOW. Six of the eight were faintly ON even when they were set to HIGH (ungrounded). I found that switching their power from 5v to 3.3v fixed everything (even though they are rated for both).I'm not electrical so I'll leave it someone else to explain.



I also faced the same problem while I was working on it for the first time. But after some debugging, I concluded that after cleanup, the pins go to the default state which is high for few pins and low for some. Trying by not to clean the state of the pins might solve your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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