
122 Make: Robotic Arms
#include "Servo.h"
Servo servoOne;
Servo servoTwo;
double x = 30.0;
double y = 120.0;
double linkOne = 100.0;
double linkTwo = 100.0;
double alphaOne;
double alphaTwo;
double alphaFinal;
double betaOne;
double betaTwo;
double betaFinal;
double c;
double d = 60.0;
double e;
const int circlePoints = 36;
double radius = 30.0;
double centerX = 40.0;
double centerY = 140.0;
void setup() {
Serial.begin(9600);
servoOne.attach(3);
servoTwo.attach(5);
}
void loop()
{
for (int i = 0; i < circlePoints; i++) {
double angle = (2 * PI / circlePoints) * i;
x = centerX + radius * cos(angle);
y = centerY + radius * sin(angle);
c = sqrt((x * x) + (y * y)); ...