// Define the analog pins to which the joystick is connected
const int joyX1 = A0;
const int joyY1 = A1;
const int joyX2 = A2;
const int joyY2 = A3;
void setup() {
// Begin serial communication at a baud rate of 9600:
Serial.begin(9600);
}
void loop() {
// Read the value from the joystick's X and Y axis
int xValue1 = analogRead(joyX1);
int yValue1 = analogRead(joyY1);
int xValue2 = analogRead(joyX2);
int yValue2 = analogRead(joyY2);
// Print the values to the serial monitor
Serial.print("X1: ");
Serial.print(xValue1);
Serial.print("\tY1: ");
Serial.println(yValue1);
Serial.print("X2: ");
Serial.print(xValue2);
Serial.print("\tY2: ");
Serial.println(yValue2);
// Wait for a short period of time before reading again
delay(100);
}