You are on page 1of 5

MENGGERAKKAN SERVO

MENGGUNAKAN TOMBOL
Mohammad Raihan
IF5C
Alat dan Bahan :
 1.arduino uno R3
 2.Breadboard Small
 3. 8 x cable
 4. 2x push button
Sketsa :
Koding :
 #include <Servo.h>
#define pin_servo 10
#define button1 12
#define button2 8
#define ditekan1 digitalRead(button1)
#define ditekan2 digitalRead(button2)

Servo mine;

void setup()
{
  pinMode(button1, INPUT_PULLUP);
  pinMode(button2, INPUT_PULLUP);
  mine.attach(pin_servo);
}

void loop()
{
  if(!ditekan1){
    mine.write(0);
 }
  else if(!ditekan2){
    mine.write(90);
 }
    
}
Video Tutorial :
 https
://drive.google.com/file/d/16ufSQjE3FSqsHK
xjQcOUzalvfTjHafzK/view?usp=drivesdk

You might also like