I’ve recently started using an Adafruit Grand Central as a wired USB game controller with the Joystick library from https://github.com/gdsports/ArduinoJoystickLibrary/tree/samd_patch.
The library has entries for eleven analog devices, but only seven are ever functional. Is this a limitation of Windows, the library, or the Grand Central? I’d like to have at least eight and ten would be even better.
The following code runs on both a Grand Central and ItsyBitsy M0 with the same results:
#include "Joystick.h"
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS,
5, 0, // Button Count, Hat Switch Count
true, true, true, // X, Y, Z
true, true, true, // Rx, Ry, and Rz
true, true, // rudder, throttle
true, true, true); // accelerator, brake, steering
void setup() {
Joystick.setXAxisRange(1000, 2000); // values correspond to general PPM pulse times in uS
Joystick.setYAxisRange(1000, 2000);
Joystick.setZAxisRange(1000, 2000);
Joystick.setRxAxisRange(1000, 2000);
Joystick.setRyAxisRange(1000, 2000);
Joystick.setRzAxisRange(1000, 2000);
Joystick.setRudderRange(1000, 2000);
Joystick.setThrottleRange(1000, 2000);
Joystick.setAcceleratorRange(1000, 2000);
Joystick.setBrakeRange(1000, 2000);
Joystick.setSteeringRange(1000, 2000);
Joystick.begin();
}
void loop() {
Joystick.setXAxis(1500);
Joystick.setYAxis(1500);
Joystick.setZAxis(1500);
Joystick.setRxAxis(1500);
Joystick.setRyAxis(1500);
Joystick.setRzAxis(1000);
Joystick.setRudder(1500);
Joystick.setThrottle(1500);
Joystick.setAccelerator(1500);
Joystick.setBrake(1500);
Joystick.setSteering(1500);
}
Here’s the result from joy.cpl:
