mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Raspberry pi GPIO don't work

Mon Feb 23, 2015 5:20 pm

.
Last edited by mibb on Thu Apr 12, 2018 1:45 pm, edited 1 time in total.

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry pi GPIO don't work

Mon Feb 23, 2015 6:20 pm

Hi and welcome to the forum.
To check the version of RPi.GPIO use this quick check python script:

Code: Select all

import RPi.GPIO as GPIO
print GPIO.VERSION
It should return version 0.5.11 :

Code: Select all

pi@raspberrypi ~ $ sudo python test2.py
0.5.11
pi@raspberrypi ~ $
If not run the following :

Code: Select all

sudo apt-get update
sudo apt-get dist-upgrade
That should get your system up to date. Then try your RPi.GPIO out again,

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Mon Feb 23, 2015 7:32 pm

.
Last edited by mibb on Thu Apr 12, 2018 1:45 pm, edited 2 times in total.

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry pi GPIO don't work

Mon Feb 23, 2015 7:48 pm

bmou1999 wrote:Thank you Texy.
I have the right version but the LED don't blink again.
Any ideas?
bmou1999
Please show us the wiring connections, and the program.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:07 am

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 1 time in total.

User avatar
joan
Posts: 15971
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:25 am

In the wiringPi example you are using gpio 18 (pin 12).

In the RPi.GPIO example you are using pin 18 (gpio 24).

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:41 am

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 2 times in total.

User avatar
DougieLawson
Posts: 42177
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:46 am

bmou1999 wrote:Thank you joan.
Which number for the LED have i to use in my python script for GPIO 18?
bmou1999
There's more than one numbering system for the pins.

You can either use "board" numbering which is simply the physical pin number, so pin 18 is right hand side nine rows down. Or your can use "Broadcom" or "BCM" numbering which uses the names of the pins on the System on a Chip (SoC) they don't have a straight mapping to the physical pins.

Take a look at http://pi.gadgetoid.com/pinout which, hopefully, clears up your confusion.

Try running the
gpio readall
command which gives a picture of the pins and their current settings.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:57 am

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 2 times in total.

User avatar
DougieLawson
Posts: 42177
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 10:58 am

RPi.GPIO.setmode(RPi.GPIO.BOARD)
RPi.GPIO.setmode(RPi.GPIO.BCM)

Allows you to pick alternative numbering schemes.

Code: Select all

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setmode(GPIO.BCM)
Choose ONE scheme and always use that in your code.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 11:40 am

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 1 time in total.

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 12:56 pm

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 2 times in total.

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 1:22 pm

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 1 time in total.

mibb
Posts: 9
Joined: Thu Mar 20, 2014 1:42 pm

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 4:28 pm

.
Last edited by mibb on Thu Apr 12, 2018 1:44 pm, edited 2 times in total.

texy
Forum Moderator
Forum Moderator
Posts: 5173
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Raspberry pi GPIO don't work

Tue Feb 24, 2015 4:30 pm

..it goes on for 1 second, then goes off. You need to add 1 second delay after the off, otherwise it will be on all the time, well to the naked eye anyway.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “Troubleshooting”