I am trying to do "LED Blink" with GPIO and Python on my RPi B+.

I am using my breakout board with a breadboard and am jumping pin 11 (GPIO 17) > resistor > LED > jump to pin 9 (GND). I am using the latest version of RPi.GPIO.

Here's my python script:

import RPi.GPIO as GPIO
import time
# blinking function
def blink(pin):
# to use Raspberry Pi board pin numbers
# set up GPIO output channel
GPIO.setup(11, GPIO.OUT)
# blink GPIO17 50 times
for i in range(0,50):

Even before it runs, the LED is on. The script does not turn the LED off or on when run as sudo, and it gives me:

blink.py:13: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(11, GPIO.OUT)

Images of my wiring: wiring overview wiring closeup

Then the script executes without further error, but the LED stays on. What is happening? Can I reset GPIO? How do I fix this?

The script still will not turn on the LED. Why not?

  • I can't see anything wrong with your code, that suggests a wiring problem. Could you add a photo of your set up to your post?
    – joan
    Jan 22, 2015 at 8:29
  • @joan I added a picture of my circuit. Excuse the mess. Jan 22, 2015 at 15:33
  • 2
    Is the ribbon cable connected the wrong way around? If you have a meter check the voltages between 3V3 and ground (3V3) and 5V and ground (5V).
    – joan
    Jan 22, 2015 at 15:38
  • It kind of looks like you actually have GPIO 27 -> resistor -> LED -> GPIO 17, although that might be the viewing angle. The red stripe on that cable should be aligned with the corner of the pi (where the 3.3 and 5 V pins are), with the cable itself facing outward, i.e., not so that it crosses over the board. They're made to work with cases that have a port in the side.
    – goldilocks
    Jan 22, 2015 at 16:09
  • 1
    It turns out the LED was in backwards. I looked at my LEDs and the lead lengths were backwards. The long was - and the short was +. Jan 30, 2015 at 5:46

1 Answer 1


According to the OP in a comment:

It turns out the LED was in backwards. I looked at my LEDs and the lead lengths were backwards. The long was - and the short was +. –

Problems of this sort have three possible causes; this was evidently the second one:

  • Incorrect code. Beware that there are several different numbering schemes used to refer to the GPIO pins. If you are working with example code, make sure it follows the same scheme you are.
  • Incorrect wiring (backward component, inverted ribbon cable, etc.)
  • Broken hardware.

Once you rule out the first two, you are stuck with the third option. If you recognize you've made a mistake with one of the first two, beware that you may have created the third problem in the process. You can permanently damage the GPIO system through incorrect use.

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.