#include <Servo.h>;
Servo myservo; //This alows for the servo motor to be programmed more effecientlly using simpler commands.
const int MotorPin = 11;
const int DialPin = A0;
int val;
int pos = 0;
int Degrees;
void setup()
{
pinMode(MotorPin, OUTPUT);
pinMode(DialPin, INPUT);
Serial.begin(9600);
myservo.attach(11); //Attach the Servo variable to pin 11
}
void loop()
{
val = analogRead(DialPin);
val = map(val, 0, 1023, 0, 180);
{
for (pos = 0, pos <= 180; pos += 1;);
myservo.write(val);
delay(15);
}
Serial.println(Degrees = myservo.read());
delay(1000);
}