Replies: 2 comments
-
Can you please check this example: https://pi4j.com/getting-started/minimal-example-application/ An input needs a different config, for example:
|
Beta Was this translation helpful? Give feedback.
-
Some of this conversation is visible only in email, not in github. And I as I can't view all your code I will make some comments. You mentioned setting the pin high before your app exits.. You coded .shutdown(DigitalState.HIGH), this will ensure your Gpio pin is high after the application exists. Also, I copied the code from the email July 17 2:43 The DigitalInput create failed until I added the line pi4j = Pi4J.newAutoContext(); immediately after the call to shutdown(). With this one line addition the code functions as I think you wanted. But, as I am making assumptions, if you still have questions please post the complete file so we know we are attempting what you want. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I tried to read and change the state of the pins on my raspberry pi 4 B with a code similar to the following:
And for me only the on and off works. So I can set the states of the pins but not read them out.
When I read them out the state is "Unknown". And for some reason I could read the state when I changed the config to this
But I don't want to set my pin to High each time that the application closes.
I didn't find anything related to the pin state Unknown, so if anyone got an Idea how I can start to read the pins without using
.shutdown(DigitalState.HIGH)
I would greatly appreciate it.Beta Was this translation helpful? Give feedback.
All reactions