George
asked on
No interrupt trigger with java pi4j on raspberry compute module
Hello,
I'am trying to use a Raspberry Compute Module. I'am using the pi4j and I try to use trigger a function when a GPIO pin state change.
I'm using the pi4j examples. I'am using the GPIO_12. When I start te program I can read the pin state and I see when the state change by pooling the GPIO Pin but there is no event triggered when the pin change the state.
I try different examples, one coming form a book. I can read the GPIO state but I have no event trigger.
here's the code.
private GpioController gpio = GpioFactory.getInstance();
private GpioPinDigitalInput kbdInt = gpio.provisionDigitalInput Pin(RaspiP in.GPIO_12 , PinPullResistance.PULL_DOW N);
kbdInt.setShutdownOptions( true);
kbdInt.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateC hangeEvent ( final GpioPinDigitalStateChangeE vent aEvent) {
System.out.println("State change");
}
});
Thanks a lot for your help
I'am trying to use a Raspberry Compute Module. I'am using the pi4j and I try to use trigger a function when a GPIO pin state change.
I'm using the pi4j examples. I'am using the GPIO_12. When I start te program I can read the pin state and I see when the state change by pooling the GPIO Pin but there is no event triggered when the pin change the state.
I try different examples, one coming form a book. I can read the GPIO state but I have no event trigger.
here's the code.
private GpioController gpio = GpioFactory.getInstance();
private GpioPinDigitalInput kbdInt = gpio.provisionDigitalInput
kbdInt.setShutdownOptions(
kbdInt.addListener(new GpioPinListenerDigital() {
@Override
public void handleGpioPinDigitalStateC
System.out.println("State change");
}
});
Thanks a lot for your help
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
ASKER