#include <Servo.h>
Servo servo1; //Servos
Servo servo2;
Servo servo3;
Servo servo4;
//Potentimeters \\//
const int pot1 = A0; // MID POT
const int pot2 = A1; // (SHOULD BE) UPPER POT
const int pot3 = A2; // LOWER POT < CLAW >
int pot1Val; //Potentimeter values
int pot2Val;
int pot3Val;
int pot1Angle;
int pot2Angle;
int pot3Angle;
void setup() {
servo1.attach(11); // Set up everything and will run once; attach servos and define the pin modes
servo2.attach(10);
servo3.attach(9);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
pot1Val = analogRead(pot1); // This will read the values from the potentimeters and store it...
pot1Angle = map(pot1Val, 0, 1023, 0, 179); // ... and this will map the values from the potentiometers to values the servos can use and store it for later use
pot2Val = analogRead(pot2);
pot2Angle = map(pot2Val, 0, 1023, 0, 179);
pot3Val = analogRead(pot3);
pot3Angle = map(pot3Val, 0, 1023, 0, 179);
servo1.write(pot1Angle); // These will make the servos move to the mapped angles
servo2.write(pot2Angle);
servo3.write(pot3Angle);
delay(10);
}