int button1 = 5;
int button2 = 6;
int button3 = 7;
int button4 = 8;
int joy1Sel = 3;
int joy2Sel = 2;
int joy1Hor = A1;
int joy2Hor = A3;
int joy1Ver = A0;
int joy2Ver = A2;
int pot1 = A6;
int pot2 = A7;
void setup() {
Serial.begin(9600);
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT_PULLUP);
pinMode(button4, INPUT_PULLUP);
pinMode(joy1Sel, INPUT_PULLUP);
pinMode(joy2Sel, INPUT_PULLUP);
}
void loop() {
// buttons
int button1State = digitalRead(button1);
int button2State = digitalRead(button2);
int button3State = digitalRead(button3);
int button4State = digitalRead(button4);
if(button1State == LOW)
Serial.println("Button 1 Pressed");
else if (button2State == LOW)
Serial.println("Button 2 Pressed");
else if (button3State == LOW)
Serial.println("Button 3 Pressed");
else if (button4State == LOW)
Serial.println("Button 4 Pressed");
// potentiometers
int pot1Value = analogRead(pot1);
int pot2Value = analogRead(pot2);
Serial.print("Potentiometer 1 Value: ");
Serial.println(pot1Value);
Serial.print("Potentiometer 2 Value: ");
Serial.println(pot2Value);
// joysticks (basically just combo pot and buttons)
int leftJoy_X = analogRead(joy1Hor);
int leftJoy_Y = analogRead(joy1Ver);
int rightJoy_X = analogRead(joy2Hor);
int rightJoy_Y = analogRead(joy2Ver);
Serial.print("Joystick 1 Values: ");
Serial.print(leftJoy_X);
Serial.print(" ");
Serial.println(leftJoy_Y);
Serial.print("Joystick 2 Values: ");
Serial.print(rightJoy_X);
Serial.print(" ");
Serial.println(rightJoy_Y);
delay(500);
}