Reputation: 534
I was trying to create a Java program which communicates with a Bluetooth module (attached to SPARKI). I'm using JSSC for the serial communication. The Bluetooth module is connected to my Windows 7 x64 PC on COM8
port. The robot is also connected to my PC via usb on COM12
port.
The following code snippet reveals, as expected, that there are 2 ports available: COM8
and COM12
String[] portNames = SerialPortList.getPortNames();
for (String port : portNames) {
System.out.println(port);
}
But when I try to open COM8
using new SerialPort("COM8").openPort();
it throws SerialPortException: Port not found
Am I missing something? Any help would be appreciated.
Also, I found articles for similar problem on Linux. The solutions were asking to change the permissions on the serial port. I don't think its possible on Windows.
Note: I'm also willing to change my programming language to either Python or C/C++ if that works out.
Upvotes: 2
Views: 2435
Reputation: 630
As wenzul said try running it as admin, open an elevated command prompt (search cmd, right click, select run as admin).
Upvotes: 3