本文整理汇总了Java中com.pi4j.io.gpio.GpioPinDigitalInput.addTrigger方法的典型用法代码示例。如果您正苦于以下问题:Java GpioPinDigitalInput.addTrigger方法的具体用法?Java GpioPinDigitalInput.addTrigger怎么用?Java GpioPinDigitalInput.addTrigger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.pi4j.io.gpio.GpioPinDigitalInput
的用法示例。
在下文中一共展示了GpioPinDigitalInput.addTrigger方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Blink Trigger Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,
PinPullResistance.PULL_DOWN);
System.out.println(" ... complete the GPIO #02 circuit and see the blink trigger take effect.");
// setup gpio pins #04 an output pins and make sure they are all LOW at startup
final GpioPinDigitalOutput myLed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, PinState.LOW);
// create a gpio control trigger on the input pin ; when the input goes HIGH, turn on blinking
myButton.addTrigger(new GpioBlinkStateTrigger(PinState.HIGH, myLed, 250));
// create a gpio control trigger on the input pin ; when the input goes LOW, turn off blinking
myButton.addTrigger(new GpioBlinkStopStateTrigger(PinState.LOW, myLed));
// keep program running until user aborts (CTRL-C)
while(true) {
Thread.sleep(500);
}
// 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
}
示例2: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Blink Trigger Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,
PinPullResistance.PULL_DOWN);
System.out.println(" ... complete the GPIO #02 circuit and see the blink trigger take effect.");
// setup gpio pins #04 an output pins and make sure they are all LOW at startup
final GpioPinDigitalOutput myLed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, PinState.LOW);
// create a gpio control trigger on the input pin ; when the input goes HIGH, turn on blinking
myButton.addTrigger(new GpioBlinkStateTrigger(PinState.HIGH, myLed, 250));
// create a gpio control trigger on the input pin ; when the input goes LOW, turn off blinking
myButton.addTrigger(new GpioBlinkStopStateTrigger(PinState.LOW, myLed));
// keep program running until user aborts (CTRL-C)
for (;;) {
Thread.sleep(500);
}
// 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
}
示例3: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// START SNIPPET: usage-create-controller-snippet
// create gpio controller instance
final GpioController gpio = GpioFactory.getInstance();
// END SNIPPET: usage-create-controller-snippet
// START SNIPPET: usage-provision-input-pin-snippet
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
// (configure pin edge to both rising and falling to get notified for HIGH and LOW state
// changes)
GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, // PIN NUMBER
"MyButton", // PIN FRIENDLY NAME (optional)
PinPullResistance.PULL_DOWN); // PIN RESISTANCE (optional)
// END SNIPPET: usage-provision-input-pin-snippet
// START SNIPPET: usage-provision-output-pin-snippet
// provision gpio pins #04 as an output pin and make sure is is set to LOW at startup
GpioPinDigitalOutput myLed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, // PIN NUMBER
"My LED", // PIN FRIENDLY NAME (optional)
PinState.LOW); // PIN STARTUP STATE (optional)
// END SNIPPET: usage-provision-output-pin-snippet
// START SNIPPET: usage-shutdown-pin-snippet
// configure the pin shutdown behavior; these settings will be
// automatically applied to the pin when the application is terminated
// ensure that the LED is turned OFF when the application is shutdown
myLed.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF);
// END SNIPPET: usage-shutdown-pin-snippet
// START SNIPPET: usage-control-pin-snippet
// explicitly set a state on the pin object
myLed.setState(PinState.HIGH);
// use convenience wrapper method to set state on the pin object
myLed.low();
myLed.high();
// use toggle method to apply inverse state on the pin object
myLed.toggle();
// use pulse method to set the pin to the HIGH state for
// an explicit length of time in milliseconds
myLed.pulse(1000);
// END SNIPPET: usage-control-pin-snippet
// START SNIPPET: usage-read-pin-snippet
// get explicit state enumeration for the GPIO pin associated with the button
PinState myButtonState = myButton.getState();
// use convenience wrapper method to interrogate the button state
boolean buttonPressed = myButton.isHigh();
// END SNIPPET: usage-read-pin-snippet
// START SNIPPET: usage-register-listener-snippet
// create and register gpio pin listener
myButton.addListener(new GpioUsageExampleListener());
// END SNIPPET: usage-register-listener-snippet
// START SNIPPET: usage-trigger-snippet
// create a gpio synchronization trigger on the input pin
// when the input state changes, also set LED controlling gpio pin to same state
myButton.addTrigger(new GpioSyncStateTrigger(myLed));
// END SNIPPET: usage-trigger-snippet
// keep program running until user aborts (CTRL-C)
while (true) {
Thread.sleep(500);
}
// 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
}
示例4: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String args[]) throws InterruptedException, IOException {
System.out.println("<--Pi4J--> GPIO Listen Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
// create custom Olimex GPIO provider
final OlimexAVRIOGpioProvider olimexProvider = new OlimexAVRIOGpioProvider(Serial.DEFAULT_COM_PORT);
// provision gpio input pin #01 from Olimex
final GpioPinDigitalInput myInput = gpio.provisionDigitalInputPin(olimexProvider, OlimexAVRIOPin.IN_01);
// create gpio pin listener
GpioPinListenerDigital listener = new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = "
+ event.getState());
}
};
// register gpio pin listener for each input pin
myButton.addListener(listener);
myInput.addListener(listener);
// setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup
GpioPinDigitalOutput myRelays[] = {
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_01, "RELAY #1", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_02, "RELAY #2", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_03, "RELAY #3", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_04, "RELAY #4", PinState.LOW)
};
// create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin #04 to HIGH
myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myRelays[0], PinState.HIGH));
// create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin #04 to LOW
myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myRelays[0], PinState.LOW));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myRelays[1]));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myRelays[2]));
// create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin #06 to the HIGH state for 1 second
myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myRelays[3], 1000));
System.out.println(" ... complete the GPIO #02 circuit and see the listener feedback here in the console.");
// keep program running until user aborts (CTRL-C)
// or we reach 60 seconds
Thread.sleep(60000);
// 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();
System.out.println("Exiting OlimexGpioExample");
}
示例5: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Trigger Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,
PinPullResistance.PULL_DOWN);
System.out.println(" ... complete the GPIO #02 circuit and see the triggers take effect.");
// setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup
GpioPinDigitalOutput myLed[] = {
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LED #1", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, "LED #2", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "LED #3", PinState.LOW)
};
// create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin #04 to HIGH
myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myLed[0], PinState.HIGH));
// create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin #04 to LOW
myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myLed[0], PinState.LOW));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myLed[1]));
// create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin #06 to the HIGH state for 1 second
myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myLed[2], 1000));
// create a gpio callback trigger on gpio pin#4; when #4 changes state, perform a callback
// invocation on the user defined 'Callable' class instance
myButton.addTrigger(new GpioCallbackTrigger(new Callable<Void>() {
public Void call() throws Exception {
System.out.println(" --> GPIO TRIGGER CALLBACK RECEIVED ");
return null;
}
}));
// keep program running until user aborts (CTRL-C)
while (true) {
Thread.sleep(500);
}
// 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
}
示例6: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// START SNIPPET: usage-create-controller-snippet
// create gpio controller instance
final GpioController gpio = GpioFactory.getInstance();
// END SNIPPET: usage-create-controller-snippet
// START SNIPPET: usage-provision-input-pin-snippet
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
// (configure pin edge to both rising and falling to get notified for HIGH and LOW state
// changes)
GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, // PIN NUMBER
"MyButton", // PIN FRIENDLY NAME (optional)
PinPullResistance.PULL_DOWN); // PIN RESISTANCE (optional)
// END SNIPPET: usage-provision-input-pin-snippet
// START SNIPPET: usage-provision-output-pin-snippet
// provision gpio pins #04 as an output pin and make sure is is set to LOW at startup
GpioPinDigitalOutput myLed = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, // PIN NUMBER
"My LED", // PIN FRIENDLY NAME (optional)
PinState.LOW); // PIN STARTUP STATE (optional)
// END SNIPPET: usage-provision-output-pin-snippet
// START SNIPPET: usage-shutdown-pin-snippet
// configure the pin shutdown behavior; these settings will be
// automatically applied to the pin when the application is terminated
// ensure that the LED is turned OFF when the application is shutdown
myLed.setShutdownOptions(true, PinState.LOW, PinPullResistance.OFF);
// END SNIPPET: usage-shutdown-pin-snippet
// START SNIPPET: usage-control-pin-snippet
// explicitly set a state on the pin object
myLed.setState(PinState.HIGH);
// use convenience wrapper method to set state on the pin object
myLed.low();
myLed.high();
// use toggle method to apply inverse state on the pin object
myLed.toggle();
// use pulse method to set the pin to the HIGH state for
// an explicit length of time in milliseconds
myLed.pulse(1000);
// END SNIPPET: usage-control-pin-snippet
// START SNIPPET: usage-read-pin-snippet
// get explicit state enumeration for the GPIO pin associated with the button
PinState myButtonState = myButton.getState();
// use convenience wrapper method to interrogate the button state
boolean buttonPressed = myButton.isHigh();
// END SNIPPET: usage-read-pin-snippet
// START SNIPPET: usage-register-listener-snippet
// create and register gpio pin listener
myButton.addListener(new GpioUsageExampleListener());
// END SNIPPET: usage-register-listener-snippet
// START SNIPPET: usage-trigger-snippet
// create a gpio synchronization trigger on the input pin
// when the input state changes, also set LED controlling gpio pin to same state
myButton.addTrigger(new GpioSyncStateTrigger(myLed));
// END SNIPPET: usage-trigger-snippet
// keep program running until user aborts (CTRL-C)
for (;;) {
Thread.sleep(500);
}
// 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
}
示例7: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String args[]) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Listen Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);
// create custom Olimex GPIO provider
final OlimexAVRIOGpioProvider olimexProvider = new OlimexAVRIOGpioProvider(Serial.DEFAULT_COM_PORT);
// provision gpio input pin #01 from Olimex
final GpioPinDigitalInput myInput = gpio.provisionDigitalInputPin(olimexProvider, OlimexAVRIOPin.IN_01);
// create gpio pin listener
GpioPinListenerDigital listener = new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
// display pin state on console
System.out.println(" --> GPIO PIN STATE CHANGE: " + event.getPin() + " = "
+ event.getState());
}
};
// register gpio pin listener for each input pin
myButton.addListener(listener);
myInput.addListener(listener);
// setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup
GpioPinDigitalOutput myRelays[] = {
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_01, "RELAY #1", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_02, "RELAY #2", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_03, "RELAY #3", PinState.LOW),
gpio.provisionDigitalOutputPin(olimexProvider, OlimexAVRIOPin.RELAY_04, "RELAY #4", PinState.LOW)
};
// create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin #04 to HIGH
myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myRelays[0], PinState.HIGH));
// create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin #04 to LOW
myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myRelays[0], PinState.LOW));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myRelays[1]));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myRelays[2]));
// create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin #06 to the HIGH state for 1 second
myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myRelays[3], 1000));
System.out.println(" ... complete the GPIO #02 circuit and see the listener feedback here in the console.");
// keep program running until user aborts (CTRL-C)
// or we reach 60 seconds
for (int seconds = 0; seconds < 60; seconds++) {
Thread.sleep(1000);
}
System.out.println(" ... exiting program.");
// 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();
}
示例8: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Trigger Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,
PinPullResistance.PULL_DOWN);
System.out.println(" ... complete the GPIO #02 circuit and see the triggers take effect.");
// setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup
GpioPinDigitalOutput myLed[] = {
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LED #1", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, "LED #2", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "LED #3", PinState.LOW)
};
// create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin #04 to HIGH
myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myLed[0], PinState.HIGH));
// create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin #04 to LOW
myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myLed[0], PinState.LOW));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myLed[1]));
// create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin #06 to the HIGH state for 1 second
myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myLed[2], 1000));
// create a gpio callback trigger on gpio pin#4; when #4 changes state, perform a callback
// invocation on the user defined 'Callable' class instance
myButton.addTrigger(new GpioCallbackTrigger(new Callable<Void>() {
public Void call() throws Exception {
System.out.println(" --> GPIO TRIGGER CALLBACK RECEIVED ");
return null;
}
}));
// keep program running until user aborts (CTRL-C)
for (;;) {
Thread.sleep(500);
}
// 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
}
示例9: main
import com.pi4j.io.gpio.GpioPinDigitalInput; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
System.out.println("<--Pi4J--> GPIO Trigger Example ... started.");
// create gpio controller
final GpioController gpio = GpioFactory.getInstance();
// provision gpio pin #02 as an input pin with its internal pull down resistor enabled
final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,
PinPullResistance.PULL_DOWN);
System.out.println(" ... complete the GPIO #02 circuit and see the triggers take effect.");
// setup gpio pins #04, #05, #06 as an output pins and make sure they are all LOW at startup
GpioPinDigitalOutput myLed[] = {
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "LED #1", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_05, "LED #2", PinState.LOW),
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_06, "LED #3", PinState.LOW)
};
// create a gpio control trigger on the input pin ; when the input goes HIGH, also set gpio pin #04 to HIGH
myButton.addTrigger(new GpioSetStateTrigger(PinState.HIGH, myLed[0], PinState.HIGH));
// create a gpio control trigger on the input pin ; when the input goes LOW, also set gpio pin #04 to LOW
myButton.addTrigger(new GpioSetStateTrigger(PinState.LOW, myLed[0], PinState.LOW));
// create a gpio synchronization trigger on the input pin; when the input changes, also set gpio pin #05 to same state
myButton.addTrigger(new GpioSyncStateTrigger(myLed[1]));
// create a gpio pulse trigger on the input pin; when the input goes HIGH, also pulse gpio pin #06 to the HIGH state for 1 second
myButton.addTrigger(new GpioPulseStateTrigger(PinState.HIGH, myLed[2], 1000));
// create a gpio callback trigger on gpio pin#4; when #4 changes state, perform a callback
// invocation on the user defined 'Callable' class instance
myButton.addTrigger(new GpioCallbackTrigger(new Callable<Void>() {
public Void call() throws Exception {
System.out.println(" --> GPIO TRIGGER CALLBACK RECEIVED ");
return null;
}
}));
// keep program running until user aborts (CTRL-C)
for (;;) {
Thread.sleep(500);
}
// 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
}