Installation

telechargement du paquet WiringPi

Référence : https://projects.drogon.net/raspberry-pi/wiringpi/

Pour obtenir WiringPi
git clone git://git.drogon.net/wiringPi


ou

http://download-codeplex.sec.s-msft.com/Download?ProjectName=trsedomotique&DownloadId=664331

Si vous avez pu cloner
cd WiringPi
git pull origin


si tout est a jours alors on peux compiler
./build


Vérification de l'installation :
pi@raspberrypi:~$ gpio -v
gpio version: 1.12
Copyright (c) 2012 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

This Raspberry Pi is a revision 2 board.

pi@raspberrypi:~$ gpio readall
+----------+------+--------+------+-------+
| wiringPi | GPIO | Name   | Mode | Value |
+----------+------+--------+------+-------+
|      0   |  17  | GPIO 0 | IN   | Low   |
|      1   |  18  | GPIO 1 | IN   | Low   |
|      2   |  27  | GPIO 2 | OUT  | Low   |
|      3   |  22  | GPIO 3 | IN   | Low   |
|      4   |  23  | GPIO 4 | IN   | Low   |
|      5   |  24  | GPIO 5 | IN   | Low   |
|      6   |  25  | GPIO 6 | IN   | Low   |
|      7   |   4  | GPIO 7 | IN   | Low   |
|      8   |   2  | SDA    | ALT0 | High  |
|      9   |   3  | SCL    | ALT0 | High  |
|     10   |   8  | CE0    | IN   | Low   |
|     11   |   7  | CE1    | IN   | Low   |
|     12   |  10  | MOSI   | IN   | Low   |
|     13   |   9  | MISO   | IN   | Low   |
|     14   |  11  | SCLK   | IN   | Low   |
|     15   |  14  | TxD    | ALT0 | Low   |
|     16   |  15  | RxD    | ALT0 | High  |
|     17   |  28  | GPIO 8 | IN   | Low   |
|     18   |  29  | GPIO 9 | IN   | Low   |
|     19   |  30  | GPIO10 | IN   | Low   |
|     20   |  31  | GPIO11 | IN   | Low   |
+----------+------+--------+------+-------+
pi@raspberrypi:~$ 

Test

Exemple avec un clignotement de la led

Se mettre sur le pin 11 (gpio 0) pour le + et le - sur 9 (GND)
Ensuite on execute le script
pi@raspberrypi:~/wiringPi$ cd examples
pi@raspberrypi:~/wiringPi/examples$ gcc -o blink blink.c -lwiringPi
pi@raspberrypi:~/wiringPi/examples$ sudo ./blink 
Raspberry Pi blink

Exemple manuel

//ecriture sur le GPIO
gpio write <pin> 0/1
//lecture sur le GPIO
gpio read <pin>

pi@raspberrypi:~/wiringPi/examples$ gpio write 0 0
pi@raspberrypi:~/wiringPi/examples$ gpio read 0
0
pi@raspberrypi:~/wiringPi/examples$ gpio write 0 1
pi@raspberrypi:~/wiringPi/examples$ gpio read 0
1


En temps normal, Apache2 se lance en tant que « www-data » et on a pour habitude de bidouiller les dossiers web de nos utilisateurs avec un « chgrp -R www-data /home/mysuer/www » avec application d’un « chmod g+s /home/myuser/www/ ».