Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Labview toggle switch (http://www.chiefdelphi.com/forums/showthread.php?t=72687)

GunfighterJ 22-01-2009 17:24

Labview toggle switch
 
is there anyway to take a joystick button and run it through a vi where it will do one function. Then go through some switch and do another function? Is there some sort of "switch" vi?

TotalChaos 22-01-2009 17:46

Re: Labview toggle switch
 
1 Attachment(s)
Quote:

Originally Posted by GunfighterJ (Post 806057)
is there anyway to take a joystick button and run it through a vi where it will do one function. Then go through some switch and do another function?

The short answer is yes.

I'm not sure there is one specific VI that does what you want, but it would certainly be possible. If I'm understanding you correctly you want a button that when pressed switches from doing one thing to another and doesn't change until the button is pressed again. If that is what you mean then you could check out the VI attached as an example of one way to do this. There is documentation of what I did on the block diagram in the VI.

- Austin

s0crates 23-01-2009 02:31

Re: Labview toggle switch
 
1 Attachment(s)
Here's what I wrote to solve that problem. toggle2.vi is a subvi that takes one input - a boolean value of whether or not the non-toggle switch is pressed. When it detects a change from 0 to 1 or from 1 to 0, it toggles the output. It does this by storing the previous input. :cool:

-jonathan
Pigmice Team 2733

BLAQmx 23-01-2009 14:45

Re: Labview toggle switch
 
1 Attachment(s)
Attached is a little code that implements this. As with every programming language this is one of about 100 ways of doing this...

Let me know if you have questions about how this works.


Cheers,
Mark

BLAQmx 23-01-2009 14:49

Re: Labview toggle switch
 
1 Attachment(s)
Opps I noticed a mistake in my attached code. This attachment has is correct.

GunfighterJ 07-02-2009 12:14

Re: Labview toggle switch
 
Quote:

Originally Posted by TotalChaos (Post 806070)
The short answer is yes.

I'm not sure there is one specific VI that does what you want, but it would certainly be possible. If I'm understanding you correctly you want a button that when pressed switches from doing one thing to another and doesn't change until the button is pressed again. If that is what you mean then you could check out the VI attached as an example of one way to do this. There is documentation of what I did on the block diagram in the VI.

- Austin

That looks complicated. But I think I can work that in to our code. Thanks for the help.

GunfighterJ 07-02-2009 12:48

Re: Labview toggle switch
 
Quote:

Originally Posted by TotalChaos (Post 806070)
The short answer is yes.

I'm not sure there is one specific VI that does what you want, but it would certainly be possible. If I'm understanding you correctly you want a button that when pressed switches from doing one thing to another and doesn't change until the button is pressed again. If that is what you mean then you could check out the VI attached as an example of one way to do this. There is documentation of what I did on the block diagram in the VI.

- Austin

That looks complicated. But I think I can work that in to our code. Thanks for the help.

Seth Moulton 13-02-2011 11:53

Re: Labview toggle switch
 
That actually wouldn't work, because you would need to put the "enum" to your driver station, which is against the rules. You need a toggle switch, so that when you hit the button once, it will initiate something, but when you release the button (causing the boolean to read "false") that same function will stay initiated until you hit the button again...

s0crates 13-02-2011 18:03

Re: Labview toggle switch
 
Bit funny, it's been 2 years since I was part of this and I had totally forgotten about this message board until I got an email notification about a thread response.

You generally should let old threads (3+ months?) die a natural death. I'm not certain how much has changed, but all this info *was* accurate as of '09. Bringing threads like this to the top of the list just serves to confuse people with old information.

It is known as "necroing" and is widely frowned upon.


All times are GMT -5. The time now is 08:34.

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