Ejemplo n.º 1
0
 @Override
 public void setShutdownOptions(
     Boolean unexport,
     PinState state,
     PinPullResistance resistance,
     PinMode mode,
     GpioPin... pin) {
   delegate.setShutdownOptions(unexport, state, resistance, mode, pin);
 }
Ejemplo n.º 2
0
  public static void main(String[] args) throws InterruptedException {

    System.out.println("<--Pi4J--> GPIO Cylon Example ... started.");

    // create gpio controller
    final GpioController gpio = GpioFactory.getInstance();

    // provision gpio pin #01 as an output pin and turn on
    final GpioPinDigitalOutput[] pins = {
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_00, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_02, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_03, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, PinState.LOW),
      gpio.provisionDigitalOutputPin(RaspiPin.GPIO_07, PinState.LOW)
    };
    System.out.println("--> GPIO state should be: ON");

    // set shutdown options on all pins
    gpio.setShutdownOptions(true, PinState.LOW, pins);

    // infinite loop
    while (true) {

      for (int index = 0; index <= 6; index++) {
        pins[index].pulse(50);
        Thread.sleep(50);
      }

      for (int index = 6; index >= 0; index--) {
        pins[index].pulse(50);
        Thread.sleep(50);
      }
    }

    // stop all GPIO activity/threads by shutting down the GPIO controller
    // (this method will forcefully shutdown all GPIO monitoring threads and scheduled tasks)
    // gpio.shutdown();   <--- implement this method call if you wish to terminate the Pi4J GPIO
    // controller
  }
Ejemplo n.º 3
0
 @Override
 public void setShutdownOptions(Boolean unexport, PinState state, GpioPin... pin) {
   delegate.setShutdownOptions(unexport, state, pin);
 }
Ejemplo n.º 4
0
 @Override
 public void setShutdownOptions(GpioPinShutdown options, GpioPin... pin) {
   delegate.setShutdownOptions(options, pin);
 }