NXT communication issues
in
Integration and Hardware
•
2 years ago
Hello,
I am using the NXT comm processing library, but am having great difficulties connecting and using the library.
I am not sure how to actually use the libraries and have found some example programs. One I am using is this....
import pt.citar.diablu.processing.nxt.*;
PFont font;
int power = 50;
LegoNXT lego;
void setup() {
size(400, 400);
font = loadFont("ArialNarrow-24.vlw");
textFont(font);
lego = new LegoNXT(this, "COM18");
frameRate(10);
}
void draw() {
background(0);
textAlign(CENTER);
textMode(SCREEN);
int batteryLevel = lego.getBatteryLevel();
// draw battery level;
fill(255);
rect(170, height, 60, -batteryLevel/90);
text("Battery: " + batteryLevel + " mv", 140, height-batteryLevel/90);
}
But when I run it I get an error saying
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: gnu/io/UnsupportedCommOperationException
at NXTCommBatteryTest.setup(NXTCommBatteryTest.java:66)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassNotFoundException: gnu.io.UnsupportedCommOperationException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 4 more
So how do I connect to the nxt via usb and know that it is working properly?
1