your correct, that should be a 4. The code came from a guy (Jens) who made the same project, however he used an earlier version of the Joystick library. I have tried to earlier version of the library, but the resolution seems lower, and the results are still the same. That being said, I have simplified it, but still same results.
#include "Joystick.h"
// https://github.com/MHeironimus/ArduinoJoystickLibrary
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 4, 0,
true , true, true, false, false, false,
false, false, true, true, true);
int gas = A0;
int brake = A1;
int clutch = A2;
int gasValue = 0;
int brakeValue = 0;
int clutchValue = 0;
// init joystick libary
void setup() {
Joystick.begin();
}
void loop() {
gasValue = analogRead(gas);
Joystick.setThrottle(gasValue);
delay(1);
brakeValue = analogRead(brake);
Joystick.setYAxis(brakeValue);
delay(1);
clutchValue = analogRead(clutch);
Joystick.setZAxis(clutchValue);
delay(1);
}