GPIO – wiringPi

In this short (but sweet) post, I’ll be explaining how to use Gordon @ Drogon’s great “wiringPi” application to control your GPIO pins. This means you will be able to control things like motors, servos, LEDs and sensors of all kinds!

First of all run:

sudo apt-get update

Then install the application using:

git clone git://

This simply goes off to the website and grabs the install files.

Then use:

cd wiringPi

And then:

sudo git pull origin

(to get the latest files!)

And finally:

sudo ./build

That’s the end of the installation process! Next, you might wanna create a test script (this one was from the wiringPi website!). Call it ‘blink.c’:

int main (void)
wiringPiSetup () ;
pinMode (0, OUTPUT) ;
for (;;)
digitalWrite (0, HIGH) ; delay (500) ;
digitalWrite (0, LOW) ; delay (500) ;
return 0 ;

To compile your c program, type:
gcc -Wall -o blink blink.c -lwiringPi
To run it:
sudo ./blink
Then, wire up your Pi and LED as follows (from Gordon’s website):


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