|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#31
|
||||
|
||||
|
Re: Labview Joystick Buttons...
EDIT 2 - I just went back and checked out a previous post which led me to the programming manual. (Which I havent read
... I'm more of a learn through experiance person) Anyways, using -1 and 1 may not work. But seeing as I don't have a way to test it I added on more to the bottom explaining how to do it so that it's at least in-line with the manual.Ok, maybe I jumped ahead and went a little too fast with my last example. Lets build on what you have and start with something simple. First off, I think it would be a good idea to clean up your code. When I'm testing things out I find it easier to test for one thing at a time to avoid clutter. I took your picture and marked some of the things I think you should take out in red. (The box with the question mark you could keep, I wasn't really sure what you were doing with it so I would just say delete it unless its important to you.) The blue box signifies what I want you to change. EDIT - And don't forget, for EVERY Open function you need a matching Close function. ![]() As a first step we'll set this up to go one way when the button is pressed and another way when then button is released (unpressed). In the blue box go ahead and get rid of the "boolean to num" function and instead add a case statement. To get that open up your palette and go to: Programming > Structures and select "Case Structure". In the True case of the case structure and a numerical constant (Function palette > Mathematics > Numeric and select "Numeric Constant") and enter in 1 as its value. Then click one of the little arrows next to where it says "True" on the case structure to switch it to the false case. In the false case add a numerical constant and enter in -1 as its value. Wire up both of the numeric constants to the right wall of the case structure and then wire the new tunnel output to the Set Relay function. Here's what it look like: (True case shown) ![]() (False case shown) ![]() Let me know how this works and then we can work from there. EDIT 2: In the blue box go ahead and get rid of the "boolean to num" function and instead add a case statement. To get that open up your palette and go to: Programming > Structures and select "Case Structure". In the True case of the case structure and a enum constant (Function palette > Mathematics > Numeric and select "Enum Constant") and enter in "Forward" as its value. Then click one of the little arrows next to where it says "True" on the case structure to switch it to the false case. In the false case add a enum constant and enter in "Reverse" as its value. Wire up both of the numeric constants to the right wall of the case structure and then wire the new tunnel output to the Set Relay function. Here's what it look like: (True case shown) http://img261.imageshack.us/img261/9...onhelp5if7.gif (False case shown) http://img504.imageshack.us/img504/8...onhelp4kk1.gif (^^^ There's a max amount of images per post, so I linked these instead) - Austin Last edited by TotalChaos : 18-01-2009 at 19:29. |
|
#32
|
|||
|
|||
|
Re: Labview Joystick Buttons...
If the case with two constants works for you, then may I suggest looking at the ternary assignment -- a fancy name for the ? : operator in C. It is actually called the Select operator. LV puts it in the Comparison palette, and it is handy for selecting one of two values without the space and hidden constant of the case structure.
Of course this is just for readability, it is equivalent at runtime. Greg McKaskle |
|
#33
|
||||
|
||||
|
Re: Labview Joystick Buttons...
...Yeah.... okay... Trying to program the joysticks' buttons... More specifically, trying to get a spike/relay to be able to be controlled by a button. (Forward/Reverse would be nice for one, Forward/Neutral/Reverse for the other) so I've looked at just about every tutorial/help guide thing that I could find... At the moment, we have two spikes on our electrical board, one of which, when attached to any of the DIO things it will stay a constant red (reverse) which does run a motor, albeit all the time and only in reverse. Code-wise, here's what I have so far (In attachments). [In the inner-most case structure, the false case is set to a constant of 'Reverse' as I believe you have said to do. Also tried 1 and -1, but to no avail.] Any help or advice would be greatly appreciated. Thank you~
|
|
#34
|
|||
|
|||
|
Re: Labview Joystick Buttons...
Were trying to do something very similar but with out the relay.
We want to have a button that on one press it turns on our traction control code, and when you press the button again it turns off our traction control code and turns on our manual speed control code. we have our two pieces of code in a case structure where true is traction control and false is manual speed control. we then wired this to a joystick button and it works other than you have to continue to hold the button down to get it to stay engaged. is there an easy way to make the joystick buttons into on/off buttons rather than momentary buttons. |
|
#35
|
||||
|
||||
|
Re: Labview Joystick Buttons...
Quote:
- Austin |
|
#36
|
|||
|
|||
|
Re: Labview Joystick Buttons...
TotalChaos,
Yup. That is exactly what we are trying to do. we want to take the momentary button and make it a toggle. i opened that vi and it looks like what i need i just need to pull out the extra items for the buttons 2 and 3. Thanks. |
|
#37
|
|||
|
|||
|
Re: Labview Joystick Buttons...
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you program joystick buttons in LabVIEW? | darkpheonix | NI LabVIEW | 10 | 13-04-2014 10:20 |
| Buttons on a Attack 3 Joystick useing LABView | morg102 | NI LabVIEW | 14 | 02-02-2010 23:28 |
| buttons in LabView | Pneumaticsman | NI LabVIEW | 4 | 12-01-2009 18:14 |
| Buttons to Pins on Joystick | yarb65 | Electrical | 1 | 24-08-2007 20:39 |
| Assigning Joystick buttons.... | archiver | 2001 | 5 | 24-06-2002 00:59 |