Is there a USB Serial Support?

Hello everybody,
I want to read some float data from USB. I checked a few posts but looks like there is only one library called juce_serial and I could not manage to run it. When I try to add it as a module, JUCE says it is not a valid module folder.
When I try to add it as an ordinary file and call getSerialPortPaths(), it returns empty data. It is not even able to get the COMs.

Is there anyone who managed to run it properly on JUCE 6?

Thanks in advance :pray:

So sorry you are still having issues. I use it for my Arduino type projects. And it is used in at least one shipping product, which has resulted in a few updates to the library.

As with JUCE, you have access to the source code, so you can step into the code to find out why you are not getting the list of ports. If you locate the issue, we can fix it.

1 Like

Thank you for your answer :pray:

I just put this code in a buttonClicked() call to see if it is able to find the serial path:

const auto portlist(SerialPort::getSerialPortPaths());

DBG("serial port:" << portlist.getAllValues()[1].toStdString()<<", size:"<< portlist.size());


DebugFunction theDebugLog;
if (portlist.size())
{
    DBG("Found at least one serial port!");
	//open the first port on the system
	SerialPort* pSP = new SerialPort(portlist.getAllValues()[0], SerialPortConfig(9600, 8, SerialPortConfig::SERIALPORT_PARITY_NONE, SerialPortConfig::STOPBITS_1, SerialPortConfig::FLOWCONTROL_NONE), theDebugLog);
	if (pSP->exists())
	{
		//create streams for reading/writing
		SerialPortOutputStream* pOutputStream = new SerialPortOutputStream(pSP);
		SerialPortInputStream* pInputStream = new SerialPortInputStream(pSP);
	}
}

Output: serial port:, size:0

I checked the juce_serialport_Windows.cpp file
This returns false.

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DEVICEMAP\\SERIALCOMM", 0, KEY_QUERY_VALUE, &hSERIALCOMM) == ERROR_SUCCESS)

Maybe I couldn’t implement it correctly. Do you have any suggestions for me ?

Interesting. This a failure at the OS level. Can you add code at the RegOpenKeyEx call to capture the return value so we can see the actual reported error?

1 Like

It was because of my admin permission. I checked my account settings and made sure that it is admin. Then I tried to run it again. It found it.

Thank you very much for the prompt reply.
Now I will try to send and get some data :slight_smile:

1 Like