/* */#include <Servo.h>
#define potPin A0
#define servo_out 11
Servo myServo;
int angle= 0;
int potVal;
int prev_potVal = 0;
void setup()
{
myServo.attach(servo_out);
Serial.begin(9600);
}
void loop()
{
potVal = analogRead(potPin);
angle = map(potVal, 0, 1023, 0, 179);
myServo.write(angle);
if (potVal != prev_potVal)
{
Serial.print("potValue= ");
Serial.print(potVal);
Serial.print("\tangle= ");
Serial.println(angle);
}
prev_potVal = potVal;
}