User avatar
RDK
Posts: 375
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Using GPIO on Pi B+

Sat May 14, 2016 3:37 pm

I've been experimenting with GPIO on a Raspberry Pi v2. Both Python code and command line commands are working. I just tried to do this on one of my Raspberry Pi B+ units and have run into a problem. My simple Python program runs and does not give any errors, however when I try to run "sudo gpio readall outputs" from a command line I get this error message "sudo: gpio: command not found". I assume that means that some parts of the GPIO system which are on the Raspberry Pi v2 by default are not on the Raspberry Pi B+?

What additional functionality do I need to install? Also, are the GPIO, BMC and physical pins the same on the Raspberry Pi B+ as on the Raspberry Pi v2?

Thanks...RDK

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

Re: Using GPIO on Pi B+

Sat May 14, 2016 3:46 pm

The pins and GPIO on the Pis with the 40 pin expansion header are identical.

You don't need sudo to run gpio, it is set uid root.

If it's not found then it's not installed (perhaps your Pi B+ has an out of date version of Raspbian or you have purged the package - try sudo apt-get install wiringpi).

User avatar
RDK
Posts: 375
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Using GPIO on Pi B+

Sat May 14, 2016 4:05 pm

OK, I ran the install command and got the following error:
$ sudo apt-get install wiringpi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package wiringpi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'wiringpi' has no installation candidate
I'm running Raspbian Wheezy on the Raspberry Pi B+, but Jessie on the Raspberry Pi v2.

As I write this I'm running the

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
commands on the Raspberry Pi B+.....RDK

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6566
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Using GPIO on Pi B+

Sat May 14, 2016 4:20 pm

RDK wrote: ...
I'm running Raspbian Wheezy on the Raspberry Pi B+, but Jessie on the Raspberry Pi v2.
As I write this I'm running the

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
commands on the Raspberry Pi B+.....RDK
IIRC, wiringPi was never "pre-installed"** with Wheezy and there's no "simple way" to "upgrade" Wheezy to Jessie (there's an old thread with specific instructions, but whether they're still valid IDK).
Trev.
** ie. it had to be installed as per the (original) instructions on the wiringPi website. At some point it became installable via apt-get, only from the "Jessie" repository (but I could be wrong).
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
RDK
Posts: 375
Joined: Wed Aug 13, 2014 10:19 am
Location: Wyoming and France

Re: Using GPIO on Pi B+

Sat May 14, 2016 4:38 pm

Oops. I did not mean to say I was going to do
sudo apt-get dist-upgrade
. I want to keep this unit on Wheezy for the time being.

WiringPi installed successfully this time. Thanks to all.....RDK

Return to “Beginners”