Page 1 of 1

GPIO pins do not work

Posted: Fri Jan 16, 2015 11:48 pm
by kiancrowley
Hi everybody,

I'm rather new to my Raspberry Pi and I've been trying to set up the GPIO pins to light up a simple LED. Using a Pi Cobbler Breakout Kit, I've attached it to a breadboard and wired up one LED with a 220 ohm resistor. However, every attempt to light the LED has been a failure. For some reason it won't light up no matter what I try to do. I've wired it up to pin #17 and then connecting it to ground as well. I also know to run the code through root. I've been using this code:
{
import RPi.GPIO as GPIO
from time import sleep

GPIO.setmode(GPIO.BCM)

GPIO.setup(17, GPIO.OUT)

while True;
GPIO.output(17, True)
sleep(2)
GPIO.output(17, False)
sleep(2)
}

I would greatly appreciate if you had any tips to solve this. I just can't seem to get any output whatsoever from the GPIO pins on this raspberry pi.
Thanks,
Kian

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 12:20 am
by klricks
Are you sure the ribbon cable on the cobbler (or RPi) is on correct way? Seems to be a common error where the cable is wrong way around.
Post a picture.

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 12:30 am
by DougieLawson
Have you got the LED round the right way? Cathode (short leg), flat on the packaging to GND, anode to the GPIO pin (with the resistor in series with the LED).

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 1:50 am
by BMS Doug
The first test (to check you are doing things right) is to run the LED from a 3v3 pin to Gnd (through a resistor).

This tests LED polarity and your u derstanding of the GPIO pin layout.

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 8:13 am
by kiancrowley
IMG_0958-2.JPG
the wiring of the LED through pin 17 and to GND
IMG_0958-2.JPG (45.6 KiB) Viewed 1188 times
I have the LED the right way and I believe the ribbon cable is the right way as well. The gray cable is towards the SD and it only goes in one way in the cobbler. I also tried the 3.3V and nothing happened. I've attached a couple pictures.

Note: Before finding the right configuration, I realized I had the ribbon cable on the wrong way on the pi and tried running code through that. However, I've long since corrected that. Maybe I could've damaged something?

Thank you all for the quick responses.

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 8:16 am
by joan
If the Pi boots there will be 3V3 available on the 3V3 pins on the expansion header (pins 1 and 17).

What colour LED? Some have a higher forward voltage requirement. Try a 5V rail pin (e.g. pins 2 or 4).

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 8:27 am
by P_Monty
I can't be sure from the picture, but I think the wiring needs a slight change. The yellow wire and resistor are ok, but it looks like the led and the other wire are all on the same strip of the breadboard, effectively bypassing the led. I'd try moving the wire one row along (it looks like it's in row 29, move it to 28 or 30) and move the end of the led nearest it to the same row. Leave the leg of the led nearest the resistor where it is.

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 9:05 am
by kiancrowley
P_Monty: You are correct! I can't believe I could have overlooked that, I've been using breadboards for about a month now. I feel silly.
Thank you so much!

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 9:06 am
by P_Monty
No problem - things like that are easily done...

Re: GPIO pins do not work

Posted: Sat Jan 17, 2015 9:28 am
by B.Goode
Perhaps an illustration of "Linus's Law'': "Given enough eyeballs, all bugs are shallow.''

From The Cathedral and the Bazaar: Eric Raymond

(But kudos to @P_Monty for eyeballing it!)