#include <ESP32Servo.h>
#define BTN1 22
#define BTN2 21

float pos = 0.0;
float step = 1.0;

Servo servo;

void setup() {
  pinMode(BTN1, INPUT_PULLUP);
  pinMode(BTN2, INPUT_PULLUP);

  servo.attach(23);
  servo.write(pos);
  Serial.begin(115200);
}

void loop() {
  if(!digitalRead(BTN1)) {
    if(pos > 0) {
      servo.write(pos);
      pos -= step;
      delay(5);
    }
  }
  if(!digitalRead(BTN2)) {
    if(pos < 180) {
      servo.write(pos);
      pos += step;
      delay(5);
    }
  }
}