Closed zaze06 closed 1 year ago
The wiring detail appears to be some additional board and not the Pi 40 pin connector. Not knowing how this maps to the pi 40 I can’t validate which pin numbering scheme you used. But the pi4j code uses the BCM numbering for the address. Also I use the linuxfs for i2c work but not gpio. So I can’t say if you encountered a bug so also try your code using the pigpio provider. My suggestions
Indeed as @taartspi pointed out digital input and output with LinuxFS are under construction... https://pi4j.com/documentation/providers/linuxfs/
Please try adding the following dependency
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-plugin-pigpio</artifactId>
<version>${pi4j.version}</version>
</dependency>
And configure the button pins with the pigpio-digital-input
provider
button1 = pi4j.create(DigitalInput.newConfigBuilder(pi4j)
.id("button")
.name("button 1")
.address(GPIOPin.GPIO27)
.pull(PullResistance.PULL_DOWN)
.debounce(3000L)
.provider("pigpio-digital-input")
);
I'm trying to update data on a screen when buttons are pressed, but the buttons whont be registered as pressed according to Pi4j button initialization:
I read the state of the buttons using the
DigitalInput#isHigh()
andDigitalInput#isLow()
methods in ajavax.swing.Timer
The timer is defined as a field and the
java.awt.event.ActionListener
is provided on the definition of the Timer. The timer is started after the buttons have ben defined.Build.gradle dependencies include
com.pi4j:pi4j-plugin-linuxfs:2.3.0
Physical setup:
links to the code parts: button setup Timer forn the button reads Build.gradle dependencies
If more information is needed I will be glad to try to provide it.