#include <ESP32Servo.h>
Servo myservo;
int pos = 0;

void setup(){
  myservo.attach(16);
  Serial.begin(115200);
}
void loop(){
  Serial.print("pos: ");
  Serial.println(pos);
  delay(1000);
  if(pos == 0){
    pos = 180;
  myservo.write(HIGH);
  delay(1000);
   myservo.write(LOW);
  } else{
     pos = 0;
   myservo.write(HIGH);
     delay(1000);
   myservo.write(LOW);
  }
}