vendredi 5 avril 2013

WiringPi for the Raspberry Pi


Using WiringPi for verifying our relay

The small complete project described in

A STARTING POINT WITH RASPBERRY PI

could use the WiringPi package for testing the relay.

The WiringPi is a library part of the Gordons projects described in https://projects.drogon.net/raspberry-pi/wiringpi/

The installation

In case our Raspberry Pi software is not up-to-date, it's better to do:

sudo apt-get update
sudo apt-get upgrade

The git sotfware is a revision control and source code management which may need tp be installed on the Raspberry: 

sudo apt-get install git-core

The Drogon projects has a repository for WiringPi which can be downloaded and installed:

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

Then, when done, we can see that the directory /home/pi/wiringPi has been created
and we should built it:

cd wiringPi
./build

The WiringPi is coming with a C/C++ library and some examples. The gpio utility is also provided in order to run GPIO command directly from a terminal.

Testing our relay

As explained in http://jbbraspberrypi.blogspot.ch/2013/03/discovering-raspberry-pi.html the relay is connected on the GPIO 14 and the gpio following command can be used to deactivate or activate the relay:


gpio -g mode 14 out
gpio -g write 14 0
gpio -g write 14 1

The parameter -g indicates that the pin numbers are interpreted as BCM_GPIO pin numbers rather than standard pin numbers.

Aucun commentaire:

Enregistrer un commentaire