-
Notifications
You must be signed in to change notification settings - Fork 77
/
twojoysticks.ino
executable file
·48 lines (43 loc) · 1.13 KB
/
twojoysticks.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <USBComposite.h>
const uint8_t reportDescription[] = {
HID_MOUSE_REPORT_DESCRIPTOR(),
HID_KEYBOARD_REPORT_DESCRIPTOR(),
HID_JOYSTICK_REPORT_DESCRIPTOR(),
HID_JOYSTICK_REPORT_DESCRIPTOR(HID_JOYSTICK_REPORT_ID+1),
};
USBCompositeSerial CompositeSerial;
USBHID HID;
HIDJoystick Joystick(HID);
HIDJoystick Joystick2(HID, HID_JOYSTICK_REPORT_ID+1);
void setup(){
HID.begin(CompositeSerial, reportDescription, sizeof(reportDescription));
while (!USBComposite);
Joystick.setManualReportMode(true);
Joystick2.setManualReportMode(true);
}
void loop(){
Joystick.X(0);
Joystick.Y(0);
Joystick.sliderRight(1023);
Joystick.send();
CompositeSerial.println("J1:0,0,1023");
delay(400);
Joystick.X(1023);
Joystick.Y(1023);
Joystick.sliderRight(0);
Joystick.send();
CompositeSerial.println("J1:1023,1023,0");
delay(400);
Joystick2.X(0);
Joystick2.Y(0);
Joystick2.sliderRight(1023);
Joystick2.send();
CompositeSerial.println("J2:0,0,1023");
delay(400);
Joystick2.X(1023);
Joystick2.Y(1023);
Joystick2.sliderRight(0);
Joystick2.send();
CompositeSerial.println("J2:1023,1023,0");
delay(400);
}