Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Xbox controller has 10 buttons, Button Array has 9 elements? (http://www.chiefdelphi.com/forums/showthread.php?t=133286)

tr6scott 01-21-2015 03:41 PM

Xbox controller has 10 buttons, Button Array has 9 elements?
 
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/sh...6&postcount=12

Bpk9p4 01-21-2015 07:40 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-21-2015 07:40 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-21-2015 07:48 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-21-2015 08:03 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
1 Attachment(s)
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 01-21-2015 10:54 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
1 Attachment(s)
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 01-22-2015 06:04 AM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-22-2015 07:16 AM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-22-2015 07:38 AM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
1 Attachment(s)
Quote:

Originally Posted by tr6scott (Post 1432007)
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.

Quote:

Originally Posted by Greg McKaskle (Post 1432012)
...the underlying code is good for 128 or more.

Now I want a game controller with 128 buttons, just like my tv remote...

cgmv123 01-22-2015 12:07 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
Quote:

Originally Posted by Mark McLeod (Post 1432018)
Now I want a game controller with 128 buttons, just like my tv remote...

You mean like this one? (Although HID apparently only supports 32 buttons.)

Greg McKaskle 01-22-2015 01:15 PM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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 01-23-2015 06:18 AM

Re: Xbox controller has 10 buttons, Button Array has 9 elements?
 
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. . .


All times are GMT -5. The time now is 06:03 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi