I have no problem with USB connection but have with Bluetooth with the same code.
I tried out my bluetooth connection with nxjcontrol.bat and it worked prefectly.
So there is no hardware/pairing problem.
here is my code:
- Code: Select all
private static NXTInfo[] nxts ;
private static NXTConnector conn = new NXTConnector();
private static NXTComm nxtCon;
private static NXTCommand nxtCommand;
/* ............... */
try{
nxtCon = NXTCommFactory.createNXTComm(NXTCommFactory.ALL_PROTOCOLS);
}catch(Exception e){
System.out.println("Error: createNXTComm");
}
//nxts = conn.search("NXT","0016530EE4AB", NXTCommFactory.ALL_PROTOCOLS);
nxts = conn.search("", null, NXTCommFactory.ALL_PROTOCOLS);
if (nxts.length == 0) {
System.out.println("No NXTS found!");
} else {
System.out.println("NXTS found!");
}
I tried both search functions but the results were the same.
They worked perfectly via USB, but did not via Bluetooth.
I'm using Netbeans with GUI, so I cannot use nxjpcc.
I think the createNXTComm is that causes the problem but I'm not certain.
Any ideas?
