You're using x & y to represent the pin numbers and to represent the readings from the pins. That's not right.
I don't know why you're subtracting 512, but that's up to you.
Try:
x = analogRead(A1) - 512;
y = analogRead(A2) - 512;
You're using x & y to represent the pin numbers and to represent the readings from the pins. That's not right.
I don't know why you're subtracting 512, but that's up to you.
Try:
x = analogRead(A1) - 512;
y = analogRead(A2) - 512;