Accessing the GPIO pins

My main interest in using the RPi is to access the GPIO pins so that I can interface with electronic projects.  For reference here’s the GPIO map from


The pins are all explained in detail at

So here’s what I did to set up access to the GPIO pins using C and Python.

Install WiringPi

This is a fantastic library written by Gordon Henderson that allows access to the GPIO pins.  It has its own web pages at:

To install simply follow the instructions on Gordon’s site.

There are various wrappers for WiringPi so that it can be accessed from other languages.  I’m learning Python so I obtained the wrapper using git:

git clone

In order to install you need some tools installed on your RPi

sudo apt-get install python-dev python-setuptools swig2.0

Then issue the command from inside the WiringPi2-Python directory:


and it will install.

Configuring I2C

The I2C interface is not activated by default in the Raspbian kernel, follow the adafruit guide to get it up and running:

Install the Adafruit WebIDE

Although not necessary to get your RPi up and running, the WebIDE is a very useful tool for running your programs from any PC on your network.  It stores your projects in the cloud which means that if all goes wrong you’ve got a backup.  The instructions for installation can be found at:

That’s about it, after a couple of hours my Raspberry Pi is back up and running and my GPIO projects are all working.  I will write about the projects in the next post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s