#include <Servo.h>
Servo myServo; // Create a servo object
int potPin = A0; // Pin connected to the slide potentiometer
int angle; // Variable to store the servo angle
void setup() {
myServo.attach(11); // Attach the servo to pin 9
}
void loop() {
int potValue = analogRead(potPin); // Read the potentiometer value
angle = map(potValue, 0, 1023, 0, 180); // Map potentiometer value to servo angle
myServo.write(angle); // Set servo position based on mapped angle
delay(15); // Delay for smoother movement, adjust as needed
}