#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
int pot1Pin = A1; // Potentiometer 1 pin
int pot2Pin = A0; // Potentiometer 0 pin
int pot3Pin = A2; // Potentiometer 2 pin
int pot4Pin = A3; // Potentiometer 3 pin
void setup() {
servo1.attach(2); // Attach servo1 to pin 2
servo2.attach(3); // Attach servo2 to pin 3
servo3.attach(4); // Attach servo3 to pin 4
servo4.attach(5); // Attach servo4 to pin 5
}
void loop() {
// Read potentiometer values and map them to servo angles
int pot1Val = map(analogRead(pot1Pin), 0, 1023, 0, 180);
int pot2Val = map(analogRead(pot2Pin), 0, 1023, 0, 180);
int pot3Val = map(analogRead(pot3Pin), 0, 1023, 0, 180);
int pot4Val = map(analogRead(pot4Pin), 0, 1023, 0, 180);
// Set servo angles
servo1.write(pot1Val);
servo2.write(pot2Val);
servo3.write(pot3Val);
servo4.write(pot4Val);
// Delay to give servos time to move
delay(15);
}