#include <Servo.h>
Servo myservo;
int servoangle = 0;
int btn1 = 3;
int btn = 2;
int val;
int val1;
void setup() {
// put your setup code here, to run once:
pinMode(btn, INPUT_PULLUP);
pinMode(btn1, INPUT_PULLUP);
Serial. begin(115200);
myservo.attach(5);
}
void loop() {
// put your main code here, to run repeatedly:
val = digitalRead(btn) ;
//Serial. println(val);
val1 = digitalRead(btn1);
if(val==0){
//servoangle = map(servoangle,0,180,0,180);
servoangle = servoangle + 1;
myservo. write(servoangle);
Serial. println(servoangle);
}
if(val1 == 0){
servoangle = servoangle - 1;
myservo. write(servoangle);
Serial. println(servoangle);
}
}