#include <ESP32Servo.h>

Servo servo;
int pinServo=26;
int pos = 0;

void setup(){
  servo.attach(pinServo, 500, 2500);
}

void loop() {

  for (pos = 0; pos <= 180; pos += 1) {
    servo.write(pos);
    delay(15);
  }
  for (pos = 180; pos >= 0; pos -= 1) {
    servo.write(pos);
    delay(15);
  }
}