#include <Servo.h>
Servo myservo;
void setup()
{
Serial.begin(9600);
myservo.attach(2);
}
void loop()
{
int potValue = analogRead(A0);
int servoAngle = map(potValue, 0, 1023, 0, 180);
Serial.println(analogRead(A0));
Serial.print("degree = ");
Serial.println(servoAngle);
myservo.write(servoAngle);
delay(1);
}