#include <Servo.h>
Servo myservo;
Servo servo1;
int pos = 0;
void setup() {
myservo.attach(9);
servo1.attach(3);
}
void loop() {
for (pos = 180; pos >= 0; pos -= 1) {
servo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
for (pos = 180; pos <= 0; pos -= 1) {
servo1.write(pos);
delay(15);
}
for (pos = 0; pos >= 180; pos += 1) {
servo1.write(pos);
delay(15);
}
//yg bawah
for (pos = 0; pos <= 180; pos += 1) {
myservo.write(pos);
delay(15);
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(15);
}
for (pos = 180; pos <= 0; pos -= 1) {
servo1.write(pos);
delay(15);
}
for (pos = 0; pos >= 180; pos += 1) {
servo1.write(pos);
delay(15);
}
}