#include <ESP32Servo.h>

Servo myservo; 
int pos = 0;    
int switch1state=0,switch2state=0;
int switch1 = 14; 
int switch2 = 12;

void setup() {
  myservo.attach(21);  
  pinMode(switch1, INPUT); 
  pinMode(switch2, INPUT);  
}

void loop() {
  switch1state = digitalRead(switch1); 
  switch2state = digitalRead(switch2); 

  if (switch1state == HIGH && pos<=180) {  
    switch1state=LOW;
    pos += 5; 
  }
  if (switch2state == HIGH && pos>=0) { 
    switch2state=LOW;
    pos -= 5;  
  }

  
    delay(100); 
  myservo.write(pos); 
 
}