#include <Servo.h>
Servo myServo;
const int potPin =A0;
void setup() {
Serial.begin(9600);
myServo.attach(9);
}
void loop() {
int potValue = analogRead(potPin);
int potValue_Mapped = map(potValue, 0, 1023, 0, 180);
Serial.print("Potentiometer Value: ");
Serial.println(potValue_Mapped);
myServo.write(potValue_Mapped);
delay(50);
}