Kura + External jar (ex :- Pi4j) problem [message #1496733] |
Wed, 03 December 2014 03:19  |
Eclipse User |
|
|
|
I tried a simple kura example with pi4j jars and I am facing this problem.
The bundle installs and runs only once , if you stop and rerun it doesn't run, even if you uninstall the bundle and install again also it doesn't even start. However if you reboot pi and install the bundle it runs only once and same problem repeats...
here's the code
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.RaspiPin;
public class HelloOsgi {
private static final Logger s_logger = LoggerFactory.getLogger(HelloOsgi.class);
private static final String APP_ID = "org.eclipse.kura.example.hello_osgi";
protected void activate(){
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput led1 = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_01);
s_logger.info("Bundle " + APP_ID + " has started!");
led1.high();
s_logger.debug(APP_ID + ": This is a debug message.");
/* for (;;) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
}
protected void deactivate() {
s_logger.info("Bundle " + APP_ID + " has stopped!");
led1.low();
gpio.shutdown();
}
}
any solution???
Thanks in advance
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Kura + External jar (ex :- Pi4j) problem [message #1792464 is a reply to message #1498518] |
Wed, 18 July 2018 06:07  |
Eclipse User |
|
|
|
Hello
I haved include jdk.dio in the manifest dependencie.
I want to used i2c bus.
but i got this error java.lang.NoClassDefFoundError: Could not initialize class jdk.dio.DeviceManager
this is my code
GPIOPinConfig pinConfig = new GPIOPinConfig(
DeviceConfig.DEFAULT, //GPIO Controller number or name
17, //GPIO Pin number
GPIOPinConfig.DIR_INPUT_ONLY, //Pin direction
GPIOPinConfig.MODE_INPUT_PULL_DOWN, //Pin resistor
GPIOPinConfig.TRIGGER_BOTH_EDGES, //Triggers
false //initial value (for outputs)
);
pin= DeviceManager.open(GPIOPin.class, pinConfig);
|
|
|
Powered by
FUDForum. Page generated in 0.04704 seconds