Documente Academic
Documente Profesional
Documente Cultură
WiringPi is now maintained under GIT for ease of change tracking, however there is a Plan B if
youre unable to use GIT for whatever reasons (usually your firewall will be blocking you, so do
check that first!)
If you do not have GIT installed, then under any of the Debian releases (e.g. Raspbian), you can
install it with:
If you get any errors here, make sure your Pi is up to date with the latest versions of Raspbian:
If you have already used the clone operation for the first time, then
cd wiringPi
git pull origin
Will fetch an updated version then you can re-run the build script below.
cd wiringPi
./build
The new build script will compile and install it all for you it does use the sudo command at one
point, so you may wish to inspect the script before running it.
Plan B
https://git.drogon.net/?p=wiringPi;a=summary
Then look for the link marked snapshot at the right-hand side. You want to click on the top one.
This will download a tar.gz file with a name like wiringPi-98bcb20.tar.gz. Note that the numbers
and letters after wiringPi (98bcb20 in this case) will probably be different theyre a unique
identifier for each release.
Remmeber the actual filename will be different you will have to check the name and adjust
accordingly.
gpio -v
gpio readall
That should give you some confidence that its working OK.
WiringPi2 for Python is an excellent GPIO handling system written by Gordon Drogon
Henderson and packaged for Python by Phil Gadgetoid Howard. It uses Arduino-like scripting
language. For simple GPIO work, I use RPi.GPIO because thats what I first got started with.
But, aside from hardware PWM, one thing I love about WiringPi2 is that it also has some extra
built-in drivers for various chips e.g. the MCP23x17 & x8 port expanders. This makes handling
expanded ports as easy as
1. defining a pin
2. setting it as input or output
3. reading or writing to the pin
All the low level heavy lifting is done for us. :) Youve still got to hook up your own wires
though. I think Gordons working on that for V3 :p
Installing WiringPi2 for Python is very simple, but there are a couple of required packages, so
well install those first. Before we install anything, though, lets update the package lists
If asked, confirm that you want to go ahead with the installation with y
This will take several minutes. When its finished, you should see this
Dependencies installed
You will see lots of messages. pip, the python package installer that you just installed, is
compiling WiringPi2 and installing it all for you. After lots of messages starting with gcc
pthread, you should see this
WiringPi2 installed :)
Lets check it
Now you should be good to go. Lets check that it works with a live Python environment
sudo python
import wiringpi2
wiringpi2.piBoardRev()
We just imported wiringpi2 and used one of its new functions piBoardRev() which is the built-in
Raspberry Pi revision checker. Notice it returned a 2, which is good because Im using a Rev 2
board. ;) If that all works as it should
You are installed and ready for action with WiringPi2s GPIO features.
I will be creating a page for simple WiringPi2 usage instructions in the near future.