Unable to open GPIO direction interface for pin #79
zhouhuabin
started this conversation in
General
Replies: 3 comments 1 reply
-
Him I think I'm facing something similar. Did you resolve your issue? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Are you using WiringPi or BCM numbers? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Him,
I resolved my issue , and avoid using gpio.provisionDigitalInputPin method :
gpio.provisionDigitalInputPin(RaspiBcmPin.GPIO_22, "input",PinPullResistance.PULL_UP);
I just use Gpio.pinMode(bcm_TiltPin, Gpio.INPUT);
then read value like this:
int value = Gpio.digitalRead(bcm_TiltPin);
not use :
int value = aihome_tiltPin.getState().getValue();
Good luck!
***@***.***
From: jmspaggi
Date: 2021-06-04 01:06
To: Pi4J/pi4j-v2
CC: 周华彬; Author
Subject: Re: [Pi4J/pi4j-v2] Unable to open GPIO direction interface for pin (#79)
Him I think I'm facing something similar. Did you resolve your issue?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I was using pi4j 1.3 to test Gpio examples on raspberry 4b, but i can not export the pin 3,7,28 with RaspiPinNumberingScheme.DEFAULT_PIN_NUMBERING,other pin number is ok. and i run command in /sys/classes/gpio echo 7 > export is also ok. i can not understand why this happen!
output:
platform:RASPBERRYPI
<--Pi4J--> GPIO test program
version:1.3
Exception in thread "main" java.lang.RuntimeException: Unable to open GPIO direction interface for pin [7]: No such file or directory
at com.pi4j.wiringpi.GpioUtil.export(Native Method)
at WiringPiGpioExample.main(WiringPiGpioExample.java:83)
main code is:
URLClassLoader cl = (URLClassLoader) (com.pi4j.platform.PlatformManager.class.getClassLoader());
URL url = cl.findResource("META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(url.openStream());
Attributes attributes = manifest.getMainAttributes();
String version = attributes.getValue("Bundle-Version");//Implementation-
System.out.println("version:"+version);
// setup wiringPi
if (Gpio.wiringPiSetup() == -1) {
System.out.println(" ==>> GPIO SETUP FAILED");
return;
}
GpioFactory.setDefaultProvider(new RaspiGpioProvider(RaspiPinNumberingScheme.DEFAULT_PIN_NUMBERING));
// set GPIO 4 as the input trigger
GpioUtil.export(7, GpioUtil.DIRECTION_IN);
GpioUtil.setEdgeDetection(7, GpioUtil.EDGE_BOTH);
Gpio.pinMode (7, Gpio.INPUT) ;
Gpio.pullUpDnControl(7, Gpio.PUD_DOWN);
Beta Was this translation helpful? Give feedback.
All reactions