I'm a rookie with Raspberry Pi and electronics in general. I was able to get my LED to turn on when I plug it into the breadboard but i'm unable to get it to respond via Python or wiringPi. The LED currently turns on as soon as there is power to the Pi.

With wiringPi i've tried this and nothing happens:

$ gpio -g mode 4 out
$ gpio -g write 4 0
$ gpio -g write 4 1

I've also tried running this code with python via $ sudo python test.py


import RPi.GPIO as GPIO
import time
print "LED on"
print "LED off"

Any idea's on what i'm doing wrong and why I can't get software to talk to my LED?

I tried switching the ribbon the other way on my Pi so here's some updated pictures. With the updated pictures i've tried this via the command line:

$ gpio -g mode 21 out
$ gpio -g write 21 0
$ gpio -g write 21 1

enter image description here

enter image description here


1 Answer 1


With the help of @joan she identified that I had my ribbon cable on backwards.

The white stripe on the ribbon needs to be on the same side as the SD card of the Pi like in this picture:

Correctly placed ribbon cable

I also had to make sure that my positive leg of the LED was connected to the resistor and the negative side was on the negative rail as in this picture:

Correctly placed resistor

  • 1
    That is one big-as LED Dec 20, 2015 at 17:16

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.