Thursday, September 27, 2012

Getting wiringPi on the Pi

wiringPi is one of the various libraries available for the raspberry pi to interface with hardware. It is similar to the wiring library for the arduino.

One barrier to adoption seems to be the complexity of the installation.

In reality, it is not that hard, but you need to have setuptools for python installed, the development package for python and git.

Then you get the code from git and do a setup install, but there is one hiccup: there is a c source file that needs to be edited. But you are a Python person, so dont panic, I provide a 1 line sed command to do the edit for you.

Altogether, here is what you need to do:


sudo apt-get install python-setuptools python-dev git-core
git clone https://github.com/WiringPi/WiringPi-Python.git
cd WiringPi-Python
git submodule update --init
sed -i 's/<wiringPi.h>/"wiringPi.h"/g' WiringPi/wiringPi/piNes.c
sudo python setup.py install
Either you run these commands one by one, or using your favorite editor, you save the whole block in a file (let's call it installwpi) and then:

pi@raspberrypi ~ $ sh installwpi

No comments: