Project

General

Profile

Example GPIO

The reference filesystem includes libgpiod and the tool utilities that can be run from the command line to access GPIO pins:

  • gpiodetect - list all gpiochips present on the system, their names, labels
    and number of GPIO lines
  • gpioinfo - list lines, their gpiochip, offset, name, and direction, and
    if in use then the consumer name and any other configured
    attributes, such as active state, bias, drive, edge detection
    and debounce period
  • gpioget - read values of specified GPIO lines
  • gpioset - set values of specified GPIO lines, holding the lines until the
    process is killed or otherwise exits
  • gpiomon - wait for edge events on GPIO lines, specify which edges to watch
    for, how many events to process before exiting, or if the events
    should be reported to the console
Detailed GPIO Example
User-level GPIO Access This example demonstrates how to access a GPIO at user-level using the "sysfs" capability.

Go to top
Add picture from clipboard (Maximum size: 1 GB)