Link to home
Start Free TrialLog in
Avatar of George
GeorgeFlag for France

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.provisionDigitalInputPin(RaspiPin.GPIO_12, PinPullResistance.PULL_DOWN);
kbdInt.setShutdownOptions(true);
kbdInt.addListener(new GpioPinListenerDigital() {
                  @Override
                  public void handleGpioPinDigitalStateChangeEvent( final GpioPinDigitalStateChangeEvent aEvent) {
                        
                        System.out.println("State change");

                  }
            });


Thanks a lot for your help
Avatar of George
George
Flag of France image

ASKER

I use wiring.Gpio instead and works great
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members 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.