Can you take a look at the attached circuit and code (below). It seems the green LED should blink but I'm not getting it to light up at all. Thoughts? Thanks so much!

Circuit: circuit diagram

Python code:

import RPi.GPIO as GPIO
import time


GPIO.setup(12, GPIO.OUT)
GPIO.output(12, GPIO.LOW)

    while True:
        GPIO.output(12, GPIO.HIGH)
        print "should be on"
        GPIO.output(12, GPIO.LOW)
        print "should be off"

except KeyboardInterrupt: # If CTRL+C is pressed, exit cleanly:
    GPIO.cleanup() # cleanup all GPIO`
  • 5
    A couple of things to check: is the LED correctly installed (LED's are polarized and need to be installed correctly) the longer leg should be to the right in the picture above, second, is the ribbon cable installed correctly - the easiest way to check this is to use a multimeter to test the power and ground pins. Jan 6, 2018 at 13:49
  • 1
    There are a lot of "my LED is not blinking or glowing" types of questions in Raspberry Pi and Arduino exchanges. Most solutions are that the wiring does not match the LED polarity. An LED is a Light Emitting Diode so it is a diode which allows current to flow in only one direction. If your voltage source is not connected to the anode (long leg) and your ground is not connected to the cathode then the LED will not light because current will not flow. A resistor, such as you have, reduces the voltage and prevent damaging the LED. startingelectronics.org/beginners/components/LED Jan 6, 2018 at 14:23
  • @joan my mistake, I mixed up the voltage drop calculations for the resistor size with the current flow. You are right, it is too much current which damages the LED. I can't seem to be able to edit the comment anymore. Jan 6, 2018 at 15:46
  • 1
    @SteveRobillard ahhh... reversed the LED.. didn't know it was polarized. Thanks so much!! Jan 6, 2018 at 15:51
  • In that case please answer your own question. Jan 6, 2018 at 15:56

1 Answer 1


As the OP realized, the LED was not polarised correctly, which prevented the light from flashing.

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.