Hello, for my school project i am writing a program in C++ to control camera movements which are controlled by the servos. I downloaded MaestroEasyExampleCpp project and i want to build on the top of that my own user interface. I understand how to set the target position, but i would like to also to have a button to click to display the current position of the servo. what command can i use to get current position of the channel?
Thank you in advance for your help.
Someone else on our forum had a similar question; you can find our response to it here.
Thanks. I will try to incorporate getVariables into my code this weekend.
Hello, i have a problem using getVariables function. From the AdvancedExample i saw this function:
[code]private void DisplayPosition()
PositionTextBox.Text = servos.position.ToString();
and i tried to implement it in c++ as follows:
device = connectToDevice(); // Find a device and connect.
textBox1->Text = System::Convert::ToString(servos.position);
catch (Exception^ exception) // Handle exceptions by displaying them to the user.
finally // Do this no matter what.
delete device; // Close the connection so other processes can use the device.
and i get errors that ‘servos’ variable is undefined and that ‘void Pololu::Usc::Usc::getVariables(Pololu::Usc::MaestroVariables %)’ : cannot convert parameter 1 to ‘Pololu::Usc::MaestroVariables %’
how do i define ‘servos’ variable and use getVariables function using c++?
Thank you in advance for your help
I tested your code using the MaestroEasyExampleCpp example in the USB SDK. From the errors, it looks like a conversion issue between C# and C++. I modified the line where you declared
servos and it compiled successfully. Here is the code I used:
Thank you so much for your help! it works now!