Jump to content

Welcome, Guest!

Sign in to follow this  

Installing WiringPi


How to install and test the wiringPi set of gpio libraries.

To make use of the Raspberry Pi's gpio pins for hardware testing I nearly always use the wiringPi library to communitcate with the gpio pins.  This set of libraries was designed by Gordon at <a href="https://projects.drogon.net/raspberry-pi/wiringpi/" target="_blank">Gordons Projects.</a>

It offers an easy way to utilise the gpio outputs and inputs on the Raspberry Pi.  

To install, open a terminal window and type the following:


git clone git://git.drogon.net/wiringPi


Once downloaded, to build the libraries, type the following:


cd wiringPi


That's it!  Easy peasy!  Lets now see how it works.

We first need to wire up an LED to our breadboard.  See this diagram for instructions on how to do this.


As you can see we have connected the LED to actual pin 11 on the Raspberry Pi.  This, in wiringPi terms, is gpio 0.  The LED is also connected to ground (GND) via a resistor.

To power the LED all we do is set the pin as an output.  Type the following into the terminal:


gpio mode 0 out


Then to light it up type:


gpio write 0 1


The write command sends current to GPIO 0 (1=send power).
To test that power is being sent (if LED doesn't light up) we can type:


gpio read 0


If the answer is (1) we know that power is being sent through the pin.  If the LED is not lit, just remove from the breadboard and change the orientation of the legs (turn it around).

To turn it off simply type:


gpio write 0 0


The write command stops current to GPIO 0 (0=stop power).

Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

About Us

Bringing you the latest Raspberry Pi news, tutorials and user forum.

The Fruity Computer