#include <ESP32Servo.h>

Servo myservo;  

void setup() {
  myservo.attach(D0);  
}

void loop() {;
  myservo.write(180);

  for(int i = 180; i > 90; i--){
    myservo.write(i);
    delay(100);
  }
  delay(1000);
  for(int x = 90; x < 180; x++){
    myservo.write(x);
    delay(100);
  }
  delay(1000);
}