This may not be the correct board, please feel free to move me to the correct one. Could not figure out which would be best.
So the joystick reads fine and everything, but there is a huge outer dead zone.
I have looked and found some scripts to calibrate, but nothing seems to work to eliminate the outer dead zone.
#define JOYSTICK_DEADZONE (30)
#define JOYSTICK_BUTTON (2)
void setup() {
// get ready to send reports on the serial connection.
// make sure your serial window is set to this baud rate
Serial.begin(57600);
// prepare the button
pinMode(JOYSTICK_BUTTON,INPUT);
}
void loop() {
int ox = analogRead(A0);
int oy = analogRead(A1);
// FYI: output = map(intput,from low,from high,to low,to high)
int mx = map(ox,0,1023,-512,512);
int my = map(oy,0,1023,-512,512);
int dx = abs(mx) < JOYSTICK_DEADZONE ? 0 : mx;
int dy = abs(my) < JOYSTICK_DEADZONE ? 0 : my;
int b = digitalRead(JOYSTICK_BUTTON);
Serial.print(ox); Serial.print('\t');
Serial.print(oy); Serial.print('\t');
Serial.print(mx); Serial.print('\t');
Serial.print(my); Serial.print('\t');
Serial.print(dx); Serial.print('\t');
Serial.print(dy); Serial.print('\t');
Serial.print(b ); Serial.print('\n');
delay(50);
}