LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Button / LED Toggle

I would like, when one button is pushed, for its corresponding LED to turn on, and an action to take place by turning True.  At the same time I would like the other LEDs to turn off, and have all the other actions to turn False.  This system will need to be in a loop so that it is possible to go back and forth between buttons ("systems of flight").


Example:
Button 1 Pushed :: LED 1 On :: System 1 True
Button 2 Off :: LED 2 Off :: System 2 Flase
Button 3 Off :: LED 3 Off :: System 3 False

Then:
Button 1 Off :: LED 1 Off :: System 1 Flase
Button 2 On :: LED 2 On :: System 2 True
Button 3 Off :: LED 3 Off :: System 3 False

Much Appreciated,
Jim
0 Kudos
Message 1 of 11
(4,851 Views)
Here is the part of the file that applies to this post (see attached).

- Jim
0 Kudos
Message 2 of 11
(4,834 Views)
Hi Jim,
 
I think this is a problem where the "Event Structure" comes in really handy.
 
See what you think...(attached VI)
 
Mark H.
 
P.S. Unfortunately I can't open your previous attachment as I only have LV 7.0 on my home PC (7.1 & 8.0 at work).

Message Edited by Mark H on 10-29-2007 08:33 PM

0 Kudos
Message 3 of 11
(4,820 Views)
No real code needed. Use a "radio button control".
 
If you replace the contents with a "Push button" you'll have the LED built-in. 🙂
 
If you wire the radio button control to a case structure, it will act like an enum and label the cases accrding to the control labels.
0 Kudos
Message 4 of 11
(4,819 Views)
Here's an example (LV 8.0) using the radio button control.
 
 
Message 5 of 11
(4,809 Views)
Hum... The stop button deserves a better treatment : to leave the program, the task must be changed. 😮
Add an event specifier to track also a value change of the stop.

Message Edité par chilly charly le 10-29-2007 10:57 PM

Chilly Charly    (aka CC)
0 Kudos
Message 6 of 11
(4,793 Views)
Yes, I forgot to add an event for the stop button press. 😄
 
This is just skeleton code. Modify as needed. Most likely you want a seperate event case for the stop button.
0 Kudos
Message 7 of 11
(4,782 Views)
this is what I finally decided to use.

thank you all

- jim q
0 Kudos
Message 8 of 11
(4,697 Views)
No. You were already told to wire the output of the case statement to the VISA Write. You still have a race condition.
0 Kudos
Message 9 of 11
(4,690 Views)
No wories. That isn't my full code; it's just a sample. It's wired the right way where it matters.

This just shows the wiring pattern for the Event Structure.
0 Kudos
Message 10 of 11
(4,676 Views)