Closed crowcey closed 1 year ago
Hi there. You can store the joystick ID in a variable, then change it as needed. Something like:
XInputControl joystick;
if(digitalRead(SwitchPin) == LOW) {
joystick = JOY_LEFT;
}
else {
joystick = JOY_RIGHT;
}
Then use the standard joystick 'set' function and pass the joystick
variable as the ID.
Thank you very much. Think that makes sense.
Can you do the same with the push buttons. I've tried every combination but can't wrap my head round it.
Yes, in exactly the same way:
XInputControl button;
if(digitalRead(SwitchPin) == LOW) {
button = BUTTON_A;
}
else {
button = BUTTON_B;
}
XInput.setButton(button, state);
BINGO!!! Thank you very much, I was close but just making a few blunders. Thanks for your help
New to all this, greatly appreciate your code and all your hard work.
Is there a way to use a switch to toggle a single joystick between left or right stick.