
112 Make: Robotic Arms
double linkTwo = 100.0;
double alphaOne;
double alphaTwo;
double alphaFinal;
double betaOne;
double betaTwo;
double betaFinal;
double c;
double d = 60.0;
double e;
int xval;
int yval;
void setup() {
Serial.begin(9600);
servoOne.attach(3);
servoTwo.attach(5);
}
void loop()
{
yval = analogRead(A0);
xval = analogRead(A1);
c = sqrt((x*x)+(y*y));
e = sqrt(((d-x)*(d-x))+(y*y));
alphaOne = atan(y/x) * (180/PI);
alphaTwo = acos(((linkTwo*linkTwo)-(c*c)-(linkOne*linkOne))
/(-2*linkOne*c)) * (180/PI);
betaOne = atan(y/(d-x)) * (180/PI);
betaTwo = acos(((linkTwo*linkTwo)-(e*e)-(linkOne*linkOne))
/(-2*linkOne*e)) * (180/PI);
if(x < 0){
alphaFinal ...