Extension of the Cross-platform C example into a C++ wrapper which implements the full serial servo command protocol.
Only tested on OS X and Linux.
This is an example of how to use this library:
#include "maestro.h"
#ifdef __APPLE__
#define MAESTRO_DEVICE "/dev/cu.usbmodem00065291"
#else
#define MAESTRO_DEVICE "/dev/ttyACM0"
#endif
using namespace std;
int main(int argc, const char * argv[])
{
try
{
Maestro maestro(MAESTRO_DEVICE);
Servo horizontalServo(0, 3968, 9216);
maestro.goHome(&horizontalServo);
} catch (std::exception& e)
{
cout << e.what() << endl;
}
return EXIT_SUCCESS;
}