#include <Servo.h>
Servo servomotor;
Servo servomotor1;
int ejeX = A0;
int ejeY = A1;
int pulsador_joystick = 22;
int lecturaX;
int lecturaY;
int lecturaPulsador;
int posicion_servo = 90;
int posicion_servo1 = 90;
void setup() {
servomotor.attach(6);
servomotor1.attach(7);
pinMode(ejeX, INPUT);
pinMode(ejeY, INPUT);
pinMode(pulsador_joystick, INPUT_PULLUP);
}
void loop() {
int lecturaX = analogRead(A0);
int lecturaY = analogRead(A1);
int lecturaPulsador = digitalRead(22);
posicion_servo=map(lecturaX,0,1023,180,0);
posicion_servo1=map(lecturaY,0,1023,180,0);
servomotor.write(posicion_servo);
servomotor1.write(posicion_servo1);
delay(10);
}