Hardware Reference
In-Depth Information
Utility gpio
For this topic, I have avoided using instances of “magic package X.” However, the
wiringPi
project is popular enough that no chapter on GPIO would be complete without
mentioning it. The
wiringPi
project provides a handy utility for displaying and changing
GPIO functionality. The package can be downloaded from here:
This page lists instructions for obtaining, compiling, and installing the package.
Once installed, the
gpio
command is available:
$ gpio −h
gpio : Usage : gpio −v
gpio −h
gpio [−g ] <read/write /wb/pwm/ clock/mode> ...
gpio [−p ] <read/write /wb> ...
gpio readall
gpio unexportall/exports ...
gpio export/edge/unexport ...
gpio drive <group> <value>
gpio pwm−bal/pwm−ms
gpio pwmr <range>
gpio pwmc <divider>
gpio load spi / i2c
gpio gbr <channel>
gpio gbw <channel> <value>
There are many options and functions within this utility. I'll just demonstrate some
quick examples of the most useful ones. Once installed, the full details of the utility can be
found by this command:
$ man 1 gpio