ArduinoJoystickLibrary
ArduinoJoystickLibrary copied to clipboard
Rudder and brake do not work at the same time
Description of Issue
I'm making a rudder pedal with brake, but when I set Rudder and Brake in the code, only Brake is available in the game controller properties and it work, but not the rudder.
Technical Details
- Arduino Board: SparkFun Pro Micro
- Host OS: Windows 10
- Arduino IDE Version: 1.8.12
Sketch File that Reproduces Issue
#include "Joystick.h"
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,
JOYSTICK_TYPE_MULTI_AXIS, 0, 0,
false, false, false, false, false, false,
true, false, false, true, false);
int rudPed = A0;
int rudValue = 0;
int brakePed = A1;
int brakeValue = 0;
void setup() {
Joystick.begin();
}
void loop () {
rudValue = analogRead(rudPed);
Joystick.setRudder(rudValue);
delay(1);
brakeValue = analogRead(brakePed);
Joystick.setBrake(brakeValue);
delay(1);
}
Additional context
When I set Throttle instead of Brake, it works normally. How can I set Rudder and Brake instead of Rudder and Throttle?
Similar issue with Z cauing the Joystick to not be detected by windows if RX or RY are enabled. Same issue if we try to add RZ and X + Y
I had a similar issue on Windows 10. I was trying to have Rudder, Throttle, Accelerator and Brake. But Rudder didn't work.
Testing the same code on Linux seems to work fine. I also tested using the Gamepad api from the browser (Chrome) and it is working as expected on Linux and Windows - https://gamepad-tester.com/
I'm not sure if Windows has any limitation regarding the combination you use in your joystick.
For now, I'm using Steering instead of Rudder and Windows is accepting it. However Steering + Accelerator become a kind of a x,y axis.
Having the same issue...
https://github.com/MHeironimus/ArduinoJoystickLibrary/issues/177
Just use another one of the axes which is not already taken
write down which axis does what function and you'll be okay
or you could re-calibrate everything
I tried your code and the rudder is not showing up in the Windows test. Everything else does though. I'm wondering if there is an issue with setRudder. I tried it with JOYSTICK and MULTI_AXIS. Also used your same code structure for all the other axis. No issues except with the rudder. I just commented it out for the time being.
#include "Joystick.h"
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_JOYSTICK,
0, 0, false, false, false, true, true, true, false, false, false, false, false);
//int rudPed = A0;
//int rudValue = 0;
int Rx = A0;
int RxValue = 0;
int Ry = A1;
int RyValue = 0;
int Rz = A2;
int RzValue = 0;
void setup() {
Joystick.setRxAxisRange(0, 1023);
//Joystick.setRudderRange(-512, 512);
Joystick.setRyAxisRange(0, 1023);
Joystick.setRzAxisRange(0, 1023);
Joystick.begin();
}
void loop() {
//rudValue = analogRead(rudPed);
//Joystick.setRudder(rudValue);
//delay(1);
RxValue = analogRead(Rx);
Joystick.setRxAxis(RxValue);
delay(1);
RyValue = analogRead(Ry);
Joystick.setRyAxis(RyValue);
delay(1);
RzValue = analogRead(Rz);
Joystick.setRzAxis(RzValue);
delay(1);
}