In this program I can able to read the GPIO pin. But pressing the hardware button(GPIO pin connected with button) for a single event cause a burst of state change and result in burst of action events.. So how can I eliminate the GPIO state change that happens concurrently for certain time period to eliminate this burst.
final GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput myButton = null;
try {
myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02,PinPullResistance.PULL_DOWN);
} catch(GpioPinExistsException e) {
}
try {
myButton.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
if(event.getState().toString().equalsIgnoreCase("HIGH") || event.getState().toString().equalsIgnoreCase("LOW")) {
System.out.println("Pressed");
}
}
});
} catch(NullPointerException e2) {
}