#include <Servo.h>
Servo myServo;
const int pos = 90;
const int tombol_kiri = 2;
const int tombol_kanan = 3;
void setup()
{
myServo.attach(5);
pinMode(tombol_kiri, INPUT_PULLUP);
pinMode(tombol_kanan, INPUT_PULLUP);
}
void loop()
{
if (digitalRead(tombol_kiri) == LOW)
{
myServo.write(0);
delay(1000);
}
else if (digitalRead(tombol_kanan) == LOW)
{
myServo.write(180);
delay(1000);
}
else
{
myServo.write(90);
}
}