Pages

Tuesday, March 05, 2013

RPIO rpio command tools learning notes


I tried the RPIO v0.08.4's rpio command tools and found very good.


RPIO 0.90 rpio, the command line tools

http://pythonhosted.org/RPIO/rpio_cmd.html#rpio-curses

rpio includes two command-line tools which allow you to inspect and manipulate GPIO’s system wide (including those used by other processes). The BCM GPIO numbering scheme is used by default.

rpio, a command-line tool to inspect and manipulate GPIOs

rpio-curses, rpio with a graphical user interface for the terminal

rpio

rpio --inspect-all (or -I) is perhaps the most popular command, which shows you all gpios on the board, with function and state. Here is an overview of all the functions of rpio:

Show the help page:

    $ rpio -h

Inspect the function and state of gpios (with -i/--inspect):

    $ rpio -i 7
    $ rpio -i 7,8,9
    $ rpio -i 1-9

    # Example output for `rpio -i 1-9` (non-existing are ommitted):

    GPIO 2: ALT0   (1)
    GPIO 3: ALT0   (1)
    GPIO 4: INPUT  (0)
    GPIO 7: OUTPUT (0)
    GPIO 8: INPUT  (1)
    GPIO 9: INPUT  (0)

Inspect all GPIO's on this board (with -I/--inspect-all):

    $ rpio -I

Set GPIO 7 output to `1` (or `0`) (with -s/--set):

    $ rpio -s 7:1

    You can only write to pins that have been set up as OUTPUT. You can
    set this yourself with `--setoutput <gpio-id>`.

Wait for interrupt events on GPIOs (with -w/--wait_for_interrupts). You
can specify an edge (eg. `:rising`; default='both') as well as `:pullup`,
`:pulldown` or `pulloff`.

    $ rpio -w 7
    $ rpio -w 7:rising
    $ rpio -w 7:falling:pullup

    $ rpio -w 7:rising:pullup,17,18
    $ rpio -w 1-9

Setup a pin as INPUT (optionally with software resistor):

    $ rpio --setinput 7
    $ rpio --setinput 7:pullup
    $ rpio --setinput 7:pulldown

Setup a pin as OUTPUT (optionally with an initial value (0 or 1)):

    $ rpio --setoutput 8
    $ rpio --setoutput 8:1

Show Raspberry Pi system info:

    $ rpio --sysinfo

    # Example output:
    000e: Model B, Revision 2.0, RAM: 256 MB, Maker: Sony
You can update the RPIO package to the latest version:

$ rpio --update-rpio

Install (and update) the rpio manpage:

$ rpio --update-man
$ man rpio

.END

No comments:

Post a Comment