Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

What libraries are available for interfacing with the GPIO?

share|improve this question

7 Answers 7

A very nice way to get started using gpio is using the /sys filesytem, you can do it all from the command line.


cd sys/class/gpio
echo 0 > export
cd gpio0
echo high > direction

More documentation in linux/Documentation/gpio.txt

share|improve this answer
Does this work with every OS? –  Alex L Jun 13 '12 at 7:12
This is linux-specific. –  blueshift Jun 13 '12 at 9:03
Are there any tutorials that use this method? I have only seen libraries (mainly the python one). –  Shane Hudson Jun 13 '12 at 13:56
Added a link to the docs. –  blueshift Jun 13 '12 at 16:44
This isn't necessarily a library as per the request of the OP. –  Andrew Larsson Jun 18 '12 at 17:04

There is one that I've found here. I haven't had the chance to test it, as my Pi hasn't arrived. It does, however, look assuring. There's even a forum thread here that professes promising payoff. If you want a down-to-the-basics C example using standard libraries, there's one here from eLinux.

share|improve this answer

RPi.GPIO is a python package for GPIO controlling.

This tutorial video shows the basic usage of the package.

share|improve this answer

quick2wire can be used by regular users (not root):

Quick2Wire Python API

A Python library for controlling the hardware attached to the Raspberry Pi's header pins, without running as the root user.

share|improve this answer
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  Mark Booth Feb 7 '13 at 0:59
@MarkBooth : "the essential part of the answer" is "can be used by regular users" unlike other answers. –  dugres Feb 7 '13 at 14:51

I use Wiring PI and it works really great. I use it with language C and had no problems so far. It is easy to understand and simple to handle.

share|improve this answer

It is really simple to control the GPIO ports in any language as shown on http://elinux.org, so I believe that you actually do not need a framework for the direct control.

You need to know which additional features you expect of a framework, like

  • Remote control via Browser
  • a pretty Browser UI or maybe a standalone program
  • automatic timebased control (cronjobs)

I ended up writing a framework for myself: Control GPIO ports over http and with cronjobs which perfectly fits my needs. I wanted to have something for home-automation. So I needed cronjobs and a JSON-Web-Interface to run a native App on my iPhone. Therefore I did not write a Browser UI. I believe would also be good for an alarm system.

I did not find a (complete) list of frameworks yet. There are some mentioned on the forum of raspberrypi.org.

share|improve this answer

Pi4J allows you to control the GPIO pins using Java. I'm not sure how it works but there's an explanation at http://pi4j.com/

share|improve this answer
Hi Matthew. This answer seems incomplete. Please can you elaborate on this library? Where can I find it, how do I use it, etc? –  Jivings Aug 3 '13 at 8:33
I added a link, if that's what you meant. I don't really know much about it. –  Matthew Aug 3 '13 at 15:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.