Class GpioListenExample


  • public class GpioListenExample
    extends Object
    This example code demonstrates how to setup a listener for GPIO pin state changes on the RaspberryPi.
    Author:
    Robert Savage
    • Constructor Detail

      • GpioListenExample

        public GpioListenExample()
    • Method Detail

      • main

        public static void main​(String[] args)
                         throws InterruptedException,
                                PlatformAlreadyAssignedException
        [ARGUMENT/OPTION "--pin (#)" | "-p (#)" ] This example program accepts an optional argument for specifying the GPIO pin (by number) to use with this GPIO listener example. If no argument is provided, then GPIO #1 will be used. -- EXAMPLE: "--pin 4" or "-p 0". [ARGUMENT/OPTION "--pull (up|down|off)" | "-l (up|down|off)" | "--up" | "--down" ] This example program accepts an optional argument for specifying pin pull resistance. Supported values: "up|down" (or simply "1|0"). If no value is specified in the command argument, then the pin pull resistance will be set to PULL_UP by default. -- EXAMPLES: "--pull up", "-pull down", "--pull off", "--up", "--down", "-pull 0", "--pull 1", "-l up", "-l down".
        Parameters:
        args -
        Throws:
        InterruptedException
        PlatformAlreadyAssignedException