#include <Servo.h>

Servo servo_1;

int servo_pin = 3;  // PWM Pin for Servo
int pos = 0;   // Servo starting position


void setup() {
  servo_1.attach(servo_pin); // start servo control
  Serial.begin(9600); // start serial monitor
  servo_1.write(pos); // move servo to previously given position: 0 degrees
  Serial.print("Positioned at ");
  Serial.print(pos);
  Serial.println(" Degrees");
  Serial.println("Input Desired Angle and Press Enter");
}


void loop() {
  while (Serial.available()){
    String angle = Serial.readStringUntil('\n'); // read until the new line
    Serial.print("Moving to: ");
    Serial.print(angle);
    Serial.println("°");
    servo_1.write(angle.toInt()); // convert angle and write servo
    delay(angle.toFloat()*(10.0/6.0)); // delay for maximum speed
  }

}

// Z20(in_char): a local variable for the input-field ("desired angle") 
// Z20('\n'): new line = new input-line for "in_char"-variable
// Z24: telling the Servo, it should go to the given position
//      the given position is the number given in the variable "in_char"
//      toInt() ... converting the text given in "in_char" to a value
$abcdeabcde151015202530fghijfghij