Hi, I am modifying a C++ program so that it can communicate with 4 Arduino boards that are used as output boards to LEDS etc.
I have imported SerialClass.h and Serial.cpp to my C++ program.
In one of my C++ module( client.cpp) when I have the
Serial* SP1 = new Serial("\\.\COM3");
Serial* SP2 = new Serial("\\.\COM4");
Serial* SP3 = new Serial("\\.\COM5");
Serial* SP4 = new Serial("\\.\COM6");
declared in the beginng of client.cpp, everything is OK. My function for sending data works fine over all 4 serial ports to the 4 Arduinos.
This solution is only working well in my development setup, as I know the COM ports that are used by the Arduinos on my PC. But, I need a solution that is not hardcoded as the COM port used by other users will be different. Therefore I have a function in client.cpp that reads the COM port numbers from an .ini file that has been set by the user.
When I run my function with i.e.
Serial* SP1 = new Serial("\\.\COM9"); ( the COM9 is read from the .ini file)
the pointer is set to NULL;
ANy ideas what is going wrong
Serial.cpp (3.67 KB)
SerialClass.h (1.07 KB)