WiringPi包含命令列的gpio函數庫工具,可以使用程式控制gpio,透過shell scripts讀寫。
1. 安裝git-core 套件,在安裝之前先更新及升級套件。
pi@raspberrypi ~ $ sudo apt-get update pi@raspberrypi ~ $ sudo apt-get upgrade pi@raspberrypi ~ $ sudo apt-get install git-core
2. 使用Git 下載程式
git clone git://git.drogon.net/wiringPi
3. 取得最新版本
pi@raspberrypi ~ $ cd wiringPi pi@raspberrypi ~ / wiringPi $ git pull origin
4. 如果已經是最新版本,可以執行以下指令:
pi@raspberrypi ~ $ cd wiringPi pi@raspberrypi ~ / wiringPi $ sudo ./build
5. 測試WiringPi是否安裝完成
顯示版本:出現一些版權宣言,並告知這個軟體是免費的
pi@raspberrypi ~ / wiringPi $ gpio -v
gpio version: 2.29 Copyright (c) 2012-2015 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry Pi Details: Type: Model B, Revision: 2, Memory: 512MB, Maker: Egoman Device tree is enabled. This Raspberry Pi supports user-level GPIO access. -> See the man-page for more details
顯示目前所有GPIO的輸入或輸出狀態
pi@raspberrypi ~ / wiringPi $ sudo gpio readall
參考網頁:
http://atceiling.blogspot.tw/2014/02/raspberry-pi-wiringpi-gpio.html#.VhTXvPmqpBc