<h1>The piio command</h1>

<hr>

<h2>Synopsis</h2>

<b>piio</b> <i>subcommand</i> ?<i>arg ...</i>?

<hr>

<h2>Description</h2>

The <b>piio</b> command lets you manipulate the Raspberry Pi gpio pins. The legal values of <i>subcommand</i> are listed below. Note that you can abbreviate the <i>subcommand</i>s.

<dl>
<dt><b>piio event</b> <i>gpiopin</i> <i>edge<i> ?<i>script<i>?
<dd>Arrange for the Tcl script <i>script</i> to be called whenever the level change specified by <i>edge</i> (<b>rising</b> or <b>falling</b>) is detected on the input port. If <i>script</i> is the empty string, the current  handler is deleted. If <i>script</i> is omitted, the currently installed script is returned (or an empty string if no such handler is installed).
<dt><b>piio function</b> ?<i>gpiopin</i>? ?<i>function</i>?
<dd>Obtain or configure the function of a <i>gpiopin</i>. When both <i>gpiopin</i> and <i>function</i> are specified, the function of the gpio pin is configured. When only a <i>gpiopin</i> is specified, the current function of the pin is returned. Without arguments a list of all pin functions is returned. The <i>gpiopin</i> must be specified as a number between 0 and 53. Valid functions are: <b>input</b>, <b>output</b>, <b>altfunc0</b>, <b>altfunc1</b>, <b>altfunc2</b>, <b>altfunc3</b>, <b>altfunc4</b>, or <b>altfunc5</b>. Check the BCM2835 documentation for the available alternate functions for each pin.
<dt><b>piio input</b> <i>gpiopin</i>
<dd>Reads the current state of the gpio pin. Returns 0 for low and 1 for a high logical level.
<dt><b>piio output</b> <i>gpiopin</i> <i>state</i>
<dd>Set the state of a gpio output pin. The state must be specified as an integer, where 0 sets the output low and any other value sets it high.
<dt><b>piio pull</b> <i>direction</i> <i>gpiopin</i> ?<i>gpiopin</i> <i>...</i>?
<dd>Control weak pull-up or -down for an input port. Valid values for <i>direction</i> are: up, down, none.
<dt><b>piio usleep</b> <i>usec</i>
<dd>When dealing with hardware it may be useful to be able to delay short amounts of time. This command will block for the specified number of microseconds.
</dl>