#include <Servo.h>
Servo servo1;
Servo servo2;
int joyX = A2;
int joyY = A3;
int servoVal;
String msg = "X angle is ";
String msg2= "Z angle is ";
void setup() { // put your setup code here, to run once:
servo1.attach(10);
servo2.attach(11);
Serial.begin(9600);
}
void loop() { // put your main code here, to run repeatedly:
servoVal = analogRead(joyX);
servoVal = map(servoVal, 0, 1023,0 , 180);
servo1.write(servoVal);
Serial.print(msg);
Serial.println(servoVal);
delay(15);
servoVal = analogRead(joyY);
servoVal = map(servoVal, 0, 1023, 0, 180);
servo2.write(servoVal);
delay(15);
Serial.print(msg2);
Serial.println(servoVal);
}