You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello PI4J guru!
I have Raspberry Pi v2 rev B, latest Rapsidian installed on it last week.
I downloaded and updated pi4j-example-fatjar-main example. Updated it to use latest PI4J 2.7.0 version. It works fine - my 3 solenoid relays are working, 1-wire temperature detector DS18B20 works fine too.
I moved all the code inside the Web App and run it under Tomcat10. No luck at all :( Every time I tried to modify set of libraries, set different "pi4j.library.path" values, move .so files to different locations I always got different exceptions like this one:
com.pi4j.provider.exception.ProviderNotFoundException: Pi4J provider IO type [DIGITAL_INPUT] could not be found. Please include this 'provider' JAR in the classpath for this provider type.
The latest attempt I made - extracted all .so files from PI4J jar files, put them into /usr/java/packages/lib folder to avoid lack of privileges, manually updated local Macen repository to 2.7.0 PI4J libs. Stil no luck.
Any ideas how to run PI4J project under Tomcat10?
Below my POM.XML file and example that works fine as a standalone application.
Thanks a lot in advance!
public void RunTest()
{
int PIN_BUTTON = 24; // BCM 24
int PIN_LED1 = 16; //
int PIN_LED2 = 20; //
int PIN_LED3 = 21; //
var pi4j = Pi4J.newAutoContext();
var buttonConfig = DigitalInput.newConfigBuilder(pi4j)
.id("button")
.name("Press button")
.address(PIN_BUTTON)
.pull(PullResistance.PULL_DOWN)
.debounce(3000L);
var button = pi4j.create(buttonConfig);
var led1 = pi4j.digitalOutput().create(PIN_LED1);
var led2 = pi4j.digitalOutput().create(PIN_LED2);
var led3 = pi4j.digitalOutput().create(PIN_LED3);
DS18B20 ds18b20Column = new DS18B20("071cd4456ff0");
for (int i=0; 1 < 5; i++)
{
console.println("Temperature sensor 1 = " + ds18b20Column.getTemperature());
try {
if (led1.equals(DigitalState.HIGH)) {
led1.low();
} else {
led1.high();
}
Thread.sleep(1000);
if (led2.equals(DigitalState.HIGH)) {
led2.low();
} else {
led2.high();
}
Thread.sleep(1000);
if (led3.equals(DigitalState.HIGH)) {
led3.low();
} else {
led3.high();
}
Thread.sleep(1000);
}
catch (Exception e)
{
//e.printStackTrace();
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello PI4J guru!
I have Raspberry Pi v2 rev B, latest Rapsidian installed on it last week.
I downloaded and updated pi4j-example-fatjar-main example. Updated it to use latest PI4J 2.7.0 version. It works fine - my 3 solenoid relays are working, 1-wire temperature detector DS18B20 works fine too.
I moved all the code inside the Web App and run it under Tomcat10. No luck at all :( Every time I tried to modify set of libraries, set different "pi4j.library.path" values, move .so files to different locations I always got different exceptions like this one:
com.pi4j.provider.exception.ProviderNotFoundException: Pi4J provider IO type [DIGITAL_INPUT] could not be found. Please include this 'provider' JAR in the classpath for this provider type.
The latest attempt I made - extracted all .so files from PI4J jar files, put them into /usr/java/packages/lib folder to avoid lack of privileges, manually updated local Macen repository to 2.7.0 PI4J libs. Stil no luck.
Any ideas how to run PI4J project under Tomcat10?
Below my POM.XML file and example that works fine as a standalone application.
Thanks a lot in advance!
4.0.0
Beta Was this translation helpful? Give feedback.
All reactions