#include <Servo.h>
// Define the servo object
Servo myServo;
Servo ahmad;
// Define the analog input pin for the potentiometer
const int potPin = A0;
const int pot1 = A1;
void setup() {
// Attach the servo to pin 9
myServo.attach(9);
ahmad.attach(10);
}
void loop() {
// Read the analog value from the potentiometer
int potValue = analogRead(potPin);
int potValue1 = analogRead(pot1);
// Map the analog value (0-1023) to the servo angle range (0-180)
int servoAngle = map(potValue, 0, 1023, 0, 180);
int servoAngle1 = map(potValue1, 0, 1023, 0, 180);
// Set the servo position based on the mapped value
myServo.write(servoAngle);
ahmad.write(servoAngle1);
// Wait for a short delay to avoid rapid servo movements
delay(15);
}