Contents
gpio_output example
Example use of the GPIO driver.
This example lets you verify the functionality of GPIO output pins. The total number of pins on the card is defined by the GPIO_PIN_NUM
macro. All pins other than those indicated in the ExceptionPinArr
array are configured for output. Each pin will be sequentially changed to a logical one (voltage on the pin) and then to a logical zero. The delay between the changes of pin state is defined by the DELAY_S
macro (the time is indicated in seconds).
ExceptionPinArr
is an array of GPIO pin numbers that need to be excluded from the example. This may be necessary if some pins are already being used for other functions, e.g. if pins are being used for a UART connection during debugging.
If you build and run this example on QEMU, an error will occur. This is the expected behavior, because there is no GPIO driver for QEMU.
If you build and run this example for Raspberry Pi 4 or Radxa ROCK 3a, an error will occur.
Example files
The code of the example and build scripts are available at the following path:
Building and running example
See Building and running examples section.
Page top