0

I am the RPi B+ user. Feeling confused about the GPIO. GPIO isn't working. I tried checking it with multimeter by connecting the pin 21 to the gnd, not work. And then i tried the 5 v and 3.3 v, it works. Any idea about this problem. I am working a project using RPi. So i need to solve it immidiately. I am a newbie abou RPi.

import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
GPIO.output(21, 1)
GPIO.cleanup()

Anyway GPIO 21 in the seventh left gpio?? Need Help!! Thanks

7
  • What are you connecting to these pins. You need a load. Without a load you risk damaging the Pin or the Pi. Please search for a pic of the GPIO pins and show us which pins (alternatively take a pic of your actual setup). Feb 27, 2015 at 7:42
  • Before i used the led and resistor 470. Not work. Then i just check it directly with multimeter. Not work too. Feb 27, 2015 at 7:45
  • Define not work? Feb 27, 2015 at 7:46
  • Sorry i am a newbie. i dont understand define. Feb 27, 2015 at 7:49
  • what do you mean by it doesn't work Feb 27, 2015 at 7:51

3 Answers 3

2

As you can see here http://pi.gadgetoid.com/pinout/gpio GPIO 21 on the right at the bottom. You are connecting it to wrong pin

0
2

gpio21 was at pin 13 in the first revision of the original Pi. In all recent models gpio27 is at pin 13.

Where two gpios are shown (x/y) the second gpio is used in current models. V indicates a voltage and that the pin is part of the power rail.

           pin  pin
3V3         1    2      5V
0/2 (SDA)   3    4      5V
1/3 (SCL)   5    6      0V
4           7    8      14 (TXD)
0V          9   10      15 (RXD)
17 (ce1)   11   12      18 (ce0)
21/27      13   14      0V
22         15   16      23
3V3        17   18      24
10 (MOSI)  19   20      0V
9 (MISO)   21   22      25
11 (SCLK)  23   24      8 (CE0)
0V         25   26      7 (CE1)
           .......
0 (ID_SD)  27   28      1 (ID_SC)
5          29   30      0V
6          31   32      12
13         33   34      0V
19 (miso)  35   36      16 (ce2)
26         37   38      20 (mosi)
0V         39   40      21 (sclk)
1

No dude, your code will turn the LED on for a millisecond and then the script will close. Put it in a While True: loop.

Example with sleep

import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.OUT)
GPIO.output(21, 1)
time.sleep(10)
GPIO.cleanup()

Your Answer

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

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