#include<Servo.h>

Servo myservo;
int angle=0;

void setup() {
  Serial.begin(9600);
  Serial.println("Write any angle between 0-180");
  myservo.attach(3);
  myservo.write(angle);
}

void loop() {
  Serial.print("Angle:");

  while(Serial.available()==0){}
  angle= Serial.parseInt();
  if (angle!="\n"){
    myservo.write(angle);
    Serial.println(angle);
  }
  
  while(Serial.available()> 0) {
    int trash = Serial.read();
  }
  delay(15);
}