
60 Make: Robotic Arms
complete the calculations built into the programming language:
double x = 120.0;
double y = 120.0;
double linkOne = 100.0;
double linkTwo = 100.0;
double thetaOne;
double thetaTwo;
void setup() {
Serial.begin(9600);
}
void loop()
{
thetaOne = (atan(y/x) + acos(((linkTwo*linkTwo)
-((x*x)+(y*y))-(linkOne*linkOne)) /
(-2*(linkOne)
*(sqrt((x*x)+(y*y))))));
double thetaOneDeg = (thetaOne*(180/PI));
thetaTwo = (acos((((x*x)+(y*y))-(linkTwo*linkTwo)
-(linkOne*linkOne)) /
(-2*(linkOne)*(linkTwo))));
double thetaTwoDeg = (thetaTwo*(180/PI));
Serial.print("Theta One: ");
Serial.print(thetaOneDeg);
Serial.print(" Theta Two: ");
Serial.println ...