- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexampleServo.cpp
More file actions
Latest commit
23 lines (17 loc) · 539 Bytes
/
Copy pathexampleServo.cpp
File metadata and controls
23 lines (17 loc) · 539 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include"motorMX430.h"
intmain()
{
//Create a servo motor: servo*(dynamyxel ID, mode, currentlimit, goalcurrent)
MotorXM430 servo1(1, 3, 800, 90);
//Accessing the motors function
servo1.PrintOperatingMode();
//Controlling the motor
servo1.TorqueON();
servo1.Goto(180);
usleep(500000);
printf("Motor %d, current position: %f\n",servo1.GetID(), servo1.ReadAngle());
//Adding others motor:
MotorXM430 servo2(2, 3, 800, 90);
printf("Motor %d, current position: %f\n",servo2.GetID(), servo2.ReadAngle());
return(0);
}