No, the xpadder cant show the axis values.
This will write the values to serial monitor:
//PINS
#define STICK_X 0
#define STICK_Y 1
#define HAT_X 2
#define HAT_Y 3
#define HAT2_X 4
#define HAT2_Y 5
//Buttons
#define HAT2_UP 9
#define HAT2_RIGHT 10
#define HAT2_DOWN 11
#define HAT2_LEFT 12
#define OVERVAL 0
int Xstick;
int Ystick;
int Xhat;
int Yhat;
int Xhat2;
int Yhat2;
const int center = 512;
const int hatThreshold = 128;
int Temp;
int myPins[] = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}
Serial.begin(9600);
//Serial.println("Joystick ready");
Joystick.useManualSend(true);
}
void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, 0, 1023);
Xstick = constrain(Xstick, 0, 1023);
Joystick.X(Xstick);
// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 1023, 0);
Ystick = constrain(Ystick, 0, 1023);
Joystick.Y(Ystick);
for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
Joystick.button(i + 1, !buttonState[i]);
oState[i] = buttonState[i]; // save state to compare next time
}
}
//HAT
Xhat = analogRead(HAT_X);
Yhat = analogRead(HAT_Y);
Serial.print("Xhat: ");
Serial.println(Xhat);
Serial.print("Yhat: ");
Serial.println(Yhat);
Serial.println("---------------------");
delay(50);
if(Xhat <= center + hatThreshold &&
Xhat >= center - hatThreshold &&
Yhat <= center + hatThreshold &&
Yhat >= center - hatThreshold)
Joystick.hat(-1);
else
{
if(Yhat >= center + hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(45);
else if(Xhat <= center - hatThreshold)
Joystick.hat(315);
else
Joystick.hat(0);
}
else if(Yhat <= center - hatThreshold){
if(Xhat >= center + hatThreshold)
Joystick.hat(135);
else if(Xhat <= center - hatThreshold)
Joystick.hat(225);
else
Joystick.hat(180);
}
else if(Xhat <= center - hatThreshold)
Joystick.hat(270);
else
Joystick.hat(90);
}
//HAT2
Xhat2 = analogRead(HAT2_X);
Yhat2 = analogRead(HAT2_Y);
if(Xhat2 <= center + hatThreshold &&
Xhat2 >= center - hatThreshold &&
Yhat2 <= center + hatThreshold &&
Yhat2 >= center - hatThreshold)
hatWithButtons(-1);
else
{
if(Yhat2 >= center + hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(45);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(315);
else
hatWithButtons(0);
}
else if(Yhat2 <= center - hatThreshold){
if(Xhat2 >= center + hatThreshold)
hatWithButtons(135);
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(225);
else
hatWithButtons(180);
}
else if(Xhat2 <= center - hatThreshold)
hatWithButtons(270);
else
hatWithButtons(90);
}
// Update joystick state
Joystick.send_now();
}
void hatWithButtons(int val){
switch(val){
case -1:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 0:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 45:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 90:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 0);
break;
case 135:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 1);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 180:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 0);
break;
case 225:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 1);
Joystick.button(HAT2_LEFT, 1);
break;
case 270:
Joystick.button(HAT2_UP, 0);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
case 315:
Joystick.button(HAT2_UP, 1);
Joystick.button(HAT2_RIGHT, 0);
Joystick.button(HAT2_DOWN, 0);
Joystick.button(HAT2_LEFT, 1);
break;
}
}
Dont use this for gaming. (I added 50 ms delay to the loop)