This thread seems close to what I want to do so I thought I would ask here. I hacked a gamepad together that uses a teensy and analog joystick to work with my XIM on xbox. The code below works as a joystick with the XIM, but I want to directly plug into the xbox one and play with this as a keyboard and analog. I didnt write this code, only slightly modified it so I dont know what i am doing. I understand the xbox can recognize composite devices, which makes sense because my mouse has keyboard keys and the xbox recognizes the mouse and its keyboard keys.
Is it possible to modify this code below to make my device work on an xbox but still keep the analog joystick function?
Code:
void setup()
{
Joystick.useManualSend(true);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
pinMode(10, INPUT_PULLUP);
pinMode(11, INPUT_PULLUP);
pinMode(12, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
pinMode(25, INPUT_PULLUP);
pinMode(26, INPUT_PULLUP);
pinMode(27, INPUT_PULLUP);
pinMode(28, INPUT_PULLUP);
}
void loop() {
Joystick.button(1, !digitalRead(2));
Joystick.button(2, !digitalRead(3));
Joystick.button(3, !digitalRead(4));
Joystick.button(4, !digitalRead(5));
Joystick.button(5, !digitalRead(6));
Joystick.button(6, !digitalRead(7));
Joystick.button(7, !digitalRead(8));
Joystick.button(8, !digitalRead(9));
Joystick.button(9, !digitalRead(10));
Joystick.button(10, !digitalRead(11));
Joystick.button(11, !digitalRead(12));
Joystick.button(12, !digitalRead(24));
Joystick.button(13, !digitalRead(25));
Joystick.button(14, !digitalRead(26));
Joystick.button(15, !digitalRead(27));
Joystick.button(16, !digitalRead(28));
Joystick.X(analogRead(0));
Joystick.Y(analogRead(1));
if(touchRead(18) > 3000) Joystick.button(17, 1);
else Joystick.button(17, 0);
if(touchRead(19) > 3000) Joystick.button(18, 1);
else Joystick.button(18, 0);
Joystick.send_now();
}