#include <Wire.h>
#include <Servo.h>
Servo myServo1;
Servo myServo2;
Servo myServo3;
Servo myServo5;
int a;
int b;
int c;
int d;
int e;
void setup() {
myServo1.attach(11);
myServo2.attach(9);
myServo3.attach(10);
myServo5.attach(7);
myServo1.write(70);
myServo2.write(130);
myServo3.write(150);
myServo5.write(150);
delay(3000);
}
void loop() {
kanan();
turun();
maju();
japit();
mundur();
naik();
kiri();
turun();
maju();
lepas();
mundur();
naik();
}
void kanan(){
for(a=70;a<=150;a++){
myServo1.write(a);
delay(59);
}
return;
}
void kiri(){
for(a=150;a>=70;a--){
myServo1.write(a);
delay(50);
}
return;
}
void mundur(){
for(b=130;b>=100;b--){
myServo2.write(b);
delay(50);
}
return;
}
void maju(){
for(b=100;b<=130;b++){
myServo2.write(b);
delay(50);
}
return;
}
void turun(){
for(c=150;c>=90;c--){
myServo3.write(c);
delay(50);
}
return;
}
void naik(){
for(c=90;c<=150;c++){
myServo3.write(c);
delay(50);
}
return;
}
void japit(){
for(e=150;e>=120;e--){
myServo5.write(e);
delay(50);
}
return;
}
void lepas(){
for(e=120;e<=150;e++){
myServo5.write(e);
delay(50);
}
return;
}