Hallo zusammen,
ich versuche gerade zum Einstieg die PI4J Standardbeispielen auf meinem PI mit Piface zum Laufen zu bekommen.
Allerdings bekomme ich hier dauernd Exceptions; der vorherige Code wird ohne Probleme allerdings ausgeführt.
Beispielsweise wenn ich SystemInfoExample ausführe, bekomme ich an dieser Stelle
[code=php]System.out.println("Processor : " + SystemInfo.getProcessor());[/php]
die Meldung:
Exception in thread "main" java.lang.RuntimeException: Invalid target: Processor
at com.pi4j.system.SystemInfo.getCpuInfo(SystemInfo.java:78)
at com.pi4j.system.SystemInfo.getProcessor(SystemInfo.java:82)
at SystemInfoExample.main(SystemInfoExample.java:58)
und bei PiFaceExample, funktioniert zwar das Blinken der LEDs, allerdings die Listener nicht
z.B.
[code=php]
// -----------------------------------------------------------------
// create a button listener for SWITCH #4
// -----------------------------------------------------------------
// -- when switch 'S4' is pressed, the cylon effect on LED03-LED07 will speed up
// -- when switch 'S4' is pressed, the cylon effect on LED03-LED07 will slow down
piface.getSwitch(PiFaceSwitch.S4).addListener(new SwitchListener() {
Override
public void onStateChange(SwitchStateChangeEvent event) {
if(event.getNewState() == SwitchState.ON){
System.out.println("[SWITCH S4 PRESSED ] CYLON <FAST>");;
cylonSpeed = 30;
}
else{
System.out.println("[SWITCH S4 RELEASED] CYLON <SLOW>");
cylonSpeed = 100;
}
}
});
Als Meldung erhalte ich:
wiringPiSetup: Unable to open /dev/mem: Keine Berechtigung
und beim Beenden des Programms:
Exception in thread "main" java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@8f5fc2 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@d7cf62[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 6727]
Jemand eine Idee, um die Programme vollständig zum Laufen zu bekommen?
[/php]