#define x_Pin A0
#define y_Pin A1
int x_Position = 0;
int y_Position = 0;
void setup()
{
Serial.begin(9600);
pinMode(x_Pin, INPUT);
pinMode(y_Pin, INPUT);
}
void loop() {
x_Position = analogRead(x_Pin);
y_Position = analogRead(y_Pin);
//menampilkan hasil pada serial monitor
Serial.print("X: ");Serial.print(x_Position);
Serial.print(" | Y: ");Serial.println(y_Position);
delay(100); //waktu tunda sebesar 100ms
}