#include <Servo.h>
Servo myservo1;
int pos = 0;
int tombol1 = 3;
int tombol2 = 2;
int posisiservo = 0;
void setup() {
myservo1.attach(6);
pinMode(tombol1, INPUT_PULLUP);
pinMode(tombol2, INPUT_PULLUP);
myservo1.write(posisiservo);
}
void loop() {
if(!digitalRead(tombol1))
{
myservo1.write(posisiservo);
posisiservo -=1;
delay(5);
}
if(!digitalRead(tombol2))
{
myservo1.write(posisiservo);
posisiservo +=1;
delay(5);
}
}