I wrote it with java in eclipse. My class to read the acc data works when i start it on its own (create a static main() with a new PApplet()).
However, when i try to use the class from another PApplet (where my game is at) and reference this Applet, like 95% of the time i try Serial.write() results in
java.lang.NullPointerException at processing.serial.Serial.write(Unknown Source) at comm.ChronosConnector$1.run(ChronosConnector.java:96)
Strangely now and then some data could be read (but only like 5%).
I guess this has something todo with Thread issues. Unfortunately i don't know how to fix this. Right now im using an extra Thread to read/write the Serial data.
Anyone got an idea how to fix this?
btw: I'm using another Serial device, too (A Polar WearLink Belt), which works fine with exactly the same structure (Extra class with extra thread to read data). However, not serial.write() but serial.bufferUntil() is used to get the data there.