ArduinoJoystickLibrary icon indicating copy to clipboard operation
ArduinoJoystickLibrary copied to clipboard

Rudder and brake do not work at the same time

Open brunombc opened this issue 4 years ago • 8 comments

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?

brunombc avatar Jul 05 '20 21:07 brunombc

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

FlisherOfatale avatar Jul 05 '20 21:07 FlisherOfatale

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.

rafaelmaiolla avatar Aug 15 '20 03:08 rafaelmaiolla

Having the same issue...

ALEEF02 avatar Sep 16 '20 02:09 ALEEF02

https://github.com/MHeironimus/ArduinoJoystickLibrary/issues/177

batbsv avatar Dec 18 '20 10:12 batbsv

Just use another one of the axes which is not already taken

VkTheProgrammer17 avatar Jan 23 '21 17:01 VkTheProgrammer17

write down which axis does what function and you'll be okay

VkTheProgrammer17 avatar Jan 23 '21 17:01 VkTheProgrammer17

or you could re-calibrate everything

VkTheProgrammer17 avatar Feb 07 '21 18:02 VkTheProgrammer17

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);
}
 

Thick8 avatar Jan 29 '23 07:01 Thick8