#include <Servo.h>
Servo servo1;
Servo servo2;
int servopin1 = 9;
int servopin2 = 10;
int joy = A1; //X-axis
int sadness = A0; //Y-axis
void setup() {
// put your setup code here, to run once:
servo1.attach(servopin1);
servo2.attach(servopin2);
pinMode(joy, INPUT);
pinMode(sadness, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int Xvalue = analogRead(joy);
Xvalue = map (Xvalue, 0, 1023, 0, 180);
servo1.write (Xvalue);
Serial.println(Xvalue);
int Yvalue = analogRead(sadness);
Yvalue = map (Yvalue, 0, 1023, 0, 180);
servo2.write (Yvalue);
Serial.println(Yvalue);
if (Xvalue>90) {}
else if (Xvalue<90) {}
else if (Yvalue<90) {}
else if (Yvalue>90) {}
}