#include <Servo.h>
Servo servo1, servo2, servo3, servo4;
const int joyX = 0, joyY = 1, SEL = 1;
void setup() {
servo1.attach(2);
servo2.attach(3);
servo3.attach(4);
servo4.attach(5);
pinMode(SEL, INPUT_PULLUP);
}
void loop() {
int joyValX = map(analogRead(joyX), 0, 1023, 0, 180);
int joyValY = map(analogRead(joyY), 0, 1023, 0, 180);
servo1.write(joyValX);
servo2.write(joyValY);
int select = digitalRead(SEL);
servo3.write(select ? 0 : 100);
servo4.write(select ? 180 : 80);
delay(15);
}