proCONTROLL problems (XBOX 360 Controller)
in
Contributed Library Questions
•
2 years ago
I'm having problems trying to use my XBOX 360 controller in processing. Bear in mind I'm a complete newbie with joypad inputs.
This is the code I have, most of it is copied straight from the examples:
My biggest issue though is I get errors with the "HandleButton1Press" lines. Both the Press and Release lines give me this error: "error on plug: >handleButton1Press< proControll found no method with that name in the given object.
Can anyone help me? I found numerous forum posts where people have seemed to get this work with XBOX 360 controllers but whenever I try to use their code I fail.
EDIT: Well I figured out the "handle" problems fairly quickly. Didn't notice I needed a function for that :X I'm still curious about getting the sticks to work though.
EDIT 2: I got the buttons working fine with the plug functions. I'm just curious about the sticks now.
EDIT 3: So the sticks do work with the sliders. Interesting. Since the Absolute Axis' corresponded to the left stick I'm assuming the rotations will work for the right stick. This is all pretty kick-ass now that I've got it working!
EDIT 4: I've been working on this for a bit and mapped out the whole controller. The only problem is I can't figure out if the right trigger is mapped or not. It doesn't show up. Here's what I got for mapping out the XBOX 360 controller:
Buttons
0 A
1 B
2 X
3 Y
4 LB
5 RB
6 SELECT
7 START
8 LSTICK (push)
9 RSTICK (push)
10 DPAD (mapping info below)
Sliders
0 Y Axis absolute (Left Stick Y)
1 X Axis absolute (Left Stick X)
2 Y Rotation absolute (Right Stick Y)
3 X Rotation absolute (Right Stick X)
4 Z Axis absolute (Left Trigger!)
DPAD CoolieHat Mapping
0.0 Nothing
1.0 Top Left
2.0 Top
3.0 Top Right
4.0 Right
5.0 Bottom Right
6.0 Bottom
7.0 Bottom Left
8.0 Left
Is there anyway the Z Axis could be passing two different values? One for left and one for right? Otherwise I have no idea where else to look for the right trigger lol.
EDIT 5: I figured it out. The Z Axis' value is positive when using the left trigger and negative when using the right trigger. BOOM! Problem solved. I'll post my updated code in a second just in case someone has this problem in the future.
This is the code I have, most of it is copied straight from the examples:
- import procontroll.*;
ControllIO controlIO;
ControllDevice xboxController;
ControllStick leftStick;
ControllStick rightStick;
void setup() {
controlIO = ControllIO.getInstance(this);
xboxController = controlIO.getDevice("Controller (XBOX 360 For Windows)");
xboxController.printButtons();
xboxController.printSliders();
xboxController.printSticks();
xboxController.plug(this, "handleButton1Press", ControllIO.ON_PRESS, 1);
xboxController.plug(this, "handleButton1Release", ControllIO.ON_RELEASE, 1);
// Sticks?
// Get sliders first
//leftStick = xboxController.getStick(0);
//rightStick = xboxController.getStick(1);
}
void draw() {
}
My biggest issue though is I get errors with the "HandleButton1Press" lines. Both the Press and Release lines give me this error: "error on plug: >handleButton1Press< proControll found no method with that name in the given object.
Can anyone help me? I found numerous forum posts where people have seemed to get this work with XBOX 360 controllers but whenever I try to use their code I fail.
EDIT: Well I figured out the "handle" problems fairly quickly. Didn't notice I needed a function for that :X I'm still curious about getting the sticks to work though.
EDIT 2: I got the buttons working fine with the plug functions. I'm just curious about the sticks now.
EDIT 3: So the sticks do work with the sliders. Interesting. Since the Absolute Axis' corresponded to the left stick I'm assuming the rotations will work for the right stick. This is all pretty kick-ass now that I've got it working!
EDIT 4: I've been working on this for a bit and mapped out the whole controller. The only problem is I can't figure out if the right trigger is mapped or not. It doesn't show up. Here's what I got for mapping out the XBOX 360 controller:
Buttons
0 A
1 B
2 X
3 Y
4 LB
5 RB
6 SELECT
7 START
8 LSTICK (push)
9 RSTICK (push)
10 DPAD (mapping info below)
Sliders
0 Y Axis absolute (Left Stick Y)
1 X Axis absolute (Left Stick X)
2 Y Rotation absolute (Right Stick Y)
3 X Rotation absolute (Right Stick X)
4 Z Axis absolute (Left Trigger!)
DPAD CoolieHat Mapping
0.0 Nothing
1.0 Top Left
2.0 Top
3.0 Top Right
4.0 Right
5.0 Bottom Right
6.0 Bottom
7.0 Bottom Left
8.0 Left
Is there anyway the Z Axis could be passing two different values? One for left and one for right? Otherwise I have no idea where else to look for the right trigger lol.
EDIT 5: I figured it out. The Z Axis' value is positive when using the left trigger and negative when using the right trigger. BOOM! Problem solved. I'll post my updated code in a second just in case someone has this problem in the future.
2