Using the command-line interface Application commands
Digi TransPort® Routers User Guide
141
gpio command: General Purpose Input Output (GPIO)
GPIO commands are necessary to configure a WR44, which has one Digital Input/Output port and one
Digital Input port. The gpio command configures an I/O port either as an input port or an output port.
For example:
Command Description
gpio inout input Configures the I/O port as an input.
gpio inout output Configures the I/O port as an output.
gpio inout on Sets the I/O port to on when configured as an output.
gpio inout off Sets the I/O port to off when configured as an output.
The syntax of the command is as follows:
gpi o [ i nout ON| OFF| i nput | out put ]
Display current status of ports
With no parameters, the gpio command displays the current status of the ports. For example:
gpi o
I nput ( s) :
i n : OFF
Out put ( s) :
i nout : OFF
OK
Set the I/O port as an output
To set the I/O port to be an output:
gpi o i nout out put
I nput ( s) :
i n : OFF
Out put ( s) :
i nout : OFF
OK
Set the I/O port to ON when configured as an output
To set the I/O port to ON when it is configured as an output:
gpi o i nout on
I nput ( s) :
i n : OFF
Out put ( s) :
i nout : ON
OK
The Input and Input/Output connections (pins 2 and 3) are programmed via the command line using
the gpio command. The default setting for pins 2 and 3 is OFF, as seen in the above example.