#include <ESP32Servo.h>
Servo x;
int a=0,b=0,c=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
x.attach(13);
pinMode(2,INPUT);
pinMode(15,INPUT);
}
void loop() {
a=digitalRead(2);
b=digitalRead(15);
if(a==HIGH && c<=180)
{
c=c+5;
a=LOW;
}
else if(b==HIGH && c>=0)
{
c=c-5;
b=LOW;
}
delay(100);
x.write(c);
}