// Define the pins for the buttons and potentiometers
const int button1Pin = 2;
const int button2Pin = 4;
const int button3Pin = 18;
const int button4Pin = 19;
const int xPotPin = 13;
const int yPotPin = 12;
const int zPotPin = 14;

void setup() {
  // Set the button pins as inputs with pull-up resistors
  pinMode(button1Pin, INPUT_PULLUP);
  pinMode(button2Pin, INPUT_PULLUP);
  pinMode(button3Pin, INPUT_PULLUP);
  pinMode(button4Pin, INPUT_PULLUP);

  // Set the potentiometer pins as inputs
  pinMode(xPotPin, INPUT);
  pinMode(yPotPin, INPUT);
  pinMode(zPotPin, INPUT);

  // Start serial communication
  Serial.begin(115200);
}

void loop() {
  // Read the state of the buttons
  int button1State = digitalRead(button1Pin);
  int button2State = digitalRead(button2Pin);
  int button3State = digitalRead(button3Pin);
  int button4State = digitalRead(button4Pin);

  // Check if a button is pressed and print the corresponding button number
  if (button1State == LOW) {
    Serial.println("Button 1 is pressed.");
  } else if (button2State == LOW) {
    Serial.println("Button 2 is pressed.");
  } else if (button3State == LOW) {
    Serial.println("Button 3 is pressed.");
  } else if (button4State == LOW) {
    Serial.println("Button 4 is pressed.");
  }

  // Read the position of the potentiometers
  int xPotVal = analogRead(xPotPin);
  int yPotVal = analogRead(yPotPin);
  int zPotVal = analogRead(zPotPin);

  // Print the values to the serial monitor
  Serial.print("X-axis: ");
  Serial.print(xPotVal);
  Serial.print(" | Y-axis: ");
  Serial.print(yPotVal);
  Serial.print(" | Z-axis: ");
  Serial.println(zPotVal);

  // Wait for a short time before reading again
  delay(10);
}