This entails the process to build a "Hello World" app using YMConnect. These steps were performed using Visual Studio 2022.
Open Visual Studio and select "Create a new project"
Select "Console App." If it doesn't show up like this. Try changing the filter drop downs or search for "Console App" in the "Search for templates" bar. Make sure that you select the template for Windows.
Name your project and select a location for the project files.
Place the included header file, lib file and dll in the project folder. Your file explorer may look different.
Open up the project properties by going to Project
-> Properties
. Under Configuration Properties
-> General
, set the C++ Language Standard
to ISO C++17 Standard
. Click apply.
Change the Configuration
dropdown to Release
and repeat step 5.
In the project properties, point the project to the lib file by going to Linker
-> Input
. Add ;YMConnect.lib
; to the additional dependencies field. Your view may look different.
Change the Configuration
dropdown to Debug
and repeat step 7. Make sure to specify ;YMConnect_D.lib
to link to the debug-library. (Note the _D
in the file name.)
Copy and paste the following code into HelloYMConnect.cpp
#include "YMConnect.h" // Include the YMConnect header file
int main()
{
StatusInfo status;
//192.168.1.31 is the default IP address for single-arm systems in North and South America.
//This should be changed if your controller has a different address.
MotomanController* c = YMConnect::OpenConnection("192.168.1.31", status); // Open a connection to the robot controller
if (status.StatusCode != 0)
{
std::cout << status << std::endl;
return status.StatusCode;
}
status = c->ControlCommands->DisplayStringToPendant("Hello from YMConnect");
std::cout << status << std::endl;
char waitForUserToPressEnter;
std::cin >> waitForUserToPressEnter;
YMConnect::CloseConnection(c);
return status.StatusCode;
}
Build the project by clicking Build
-> Build YMConnect
.
When the project builds successfully, start debugging by pressing F5
or going to Debug
-> Start Debugging
.
If the project runs successfully, the terminal will output
Code (0): OK
The pendant will look like this...