Log in

View Full Version : Xbox controller has 10 buttons, Button Array has 9 elements?


tr6scott
21-01-2015, 15:41
Posted question here, but after, figured it was best to start a new thread to be seen.

So we are trying to code a feature with "button 9" of the xbox controller, but the button array in labview only has 9 elements.

Both the team 358 diagram and the array index start with 0.

So the Joystick has 10 buttons, from 0 to 9, yet the array only has 9 elements from 0 to 8.

Tell me where I messed up. :)

http://www.chiefdelphi.com/forums/showpost.php?p=1431666&postcount=12

Bpk9p4
21-01-2015, 19:40
i had the same problem. what you need to do is right click and add a new variable to the array. i do no have labview in front of me now but if you have more trouble let me know and i will get a screen shot for you

Mark McLeod
21-01-2015, 19:40
I'm afraid I don't follow what problem you are encountering.
Perhaps a screen shot or snippet?

I split out the buttons from a joystick and can see all 10 (0-9).
You can also use Index Array to specifically ask for button 9.

Mark McLeod
21-01-2015, 19:48
Oh, you're using old code from last year?
The button cluster was removed from the palette this year, so I didn't even think of it.

tr6scott
21-01-2015, 20:03
Mark,

The "default" button array only has 9 elements, so we can't pull the 10th button, "Buttons[9]"

I added the array to cluster and the unbundle by name, to show issue.

I will try to add another value, but I would think that would be in the "Get Values" vi.

Mark McLeod
21-01-2015, 22:54
I understand now.

To get the 10th button right-click on Array to Cluster and choose Cluster Size...
Change 9 to 10.
You should see Button 9 in the button cluster.

Array to Cluster defaults to 9 items.

tr6scott
22-01-2015, 06:04
Interesting, but we were having an issue with the code above with the index array, and pulling the boolean data from the 9th element. . .

If the problem is in the array to cluster, then the index should have worked...

humm..

Greg McKaskle
22-01-2015, 07:16
I agree with Mark. I tested the buttons with the TI board for 32 buttons, and the underlying code is good for 128 or more. The silly conversion to cluster doesn't know how many elements you need, and has to decide at compile time. It has that popup that almost nothing else has, and trips up people all the time -- one of these days ...

Greg McKaskle

Mark McLeod
22-01-2015, 07:38
Interesting, but we were having an issue with the code above with the index array, and pulling the boolean data from the 9th element. . .

If the problem is in the array to cluster, then the index should have worked...

humm..

I've never had any problem with index array, so something odd is going on.

...the underlying code is good for 128 or more.
Now I want a game controller with 128 buttons, just like my tv remote...

cgmv123
22-01-2015, 12:07
Now I want a game controller with 128 buttons, just like my tv remote...

You mean like this one (http://forum.arcadecontrols.com/index.php?topic=137788.0)? (Although HID apparently only supports 32 buttons.)

Greg McKaskle
22-01-2015, 13:15
DIJOYSTATE2 has four POVs, 128 buttons, and eight axes and quite a few calculated values. Since DInput has this, I was assuming that it matched HID. I poked around and found different opinions. I hope I never have a device that pushes that boundary.

Greg McKaskle

tr6scott
23-01-2015, 06:18
After retesting code last night we are also NOT having an issue with the index array either!

(We are having an issue understanding troubleshooting labview)
(and that cluster got me too)

and you two can stop talking about these controllers, they are generating hardware requests. . .