MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
GNU Lesser General Public License v3.0
2.06k stars 403 forks source link

Multiple Joystick Issue #248

Open errorflash opened 1 year ago

errorflash commented 1 year ago

Is it possible to get an easy example (not the test example) ??

eg.:

Joystick A........... Joystick B...........

Buttons........

Analag IN A........ Analog IN B.......

I have no big brain in Programming and i don`t understand the Test code for own Projects.

Thanks for help!

`/ Bagger Joysticks 1.0 /

include

Joystick_ {joystick1(0x04, JOYSTICK_TYPEJOYSTICK, 3, 0, true, true, false, false, false, false, false, false, false, false, false)}; Joystick {joystick2(0x03, JOYSTICK_TYPE_JOYSTICK, 3, 0, true, true, false, false, false, false, false, false, false, false, false)};

const int pinToButtonMap = 2;

void setup(){

joystick1.setXAxisRange(-127, 127);
joystick1.setYAxisRange(-127, 127);

joystick2.setXAxisRange(-127, 127);
joystick2.setYAxisRange(-127, 127);

joystick1.begin();
joystick2.begin();

pinMode(2, INPUT_PULLUP); pinMode(3, INPUT_PULLUP); pinMode(4, INPUT_PULLUP); pinMode(5, INPUT_PULLUP); pinMode(6, INPUT_PULLUP); pinMode(7, INPUT_PULLUP);

const int pinToButtonMap = 2; } void loop() {

}`

MHeironimus commented 1 year ago

I believe the GamepadExample or the FunduinoJoystickShield examples that are provided with the library are what you are looking for. You can also check out http://mheironimus.blogspot.com/2022/07/simple-arduino-leonardo-usb-game-pad.html?m=1.