LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to use a 3 way switch in labview

Solved!
Go to solution
Highlighted

I need to use a 3 way switch. How can I do that?

0 Kudos
Message 1 of 41
(812 Views)
Highlighted

Hi Neha,

 

have you tried to search this forum for a solution? There are several threads about "3-way switches"…

 

Simple, quick solution: use a pointer slide control set to exactly 3 possible input values!

When you want the appearance of a real "3-way switch" you are into control cusotmization, which is described in the LabVIEW help (or in those threads I recommended to search for)…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 41
(803 Views)
Highlighted

To be lexically nit-picky: What your talking about here is a '3-position switch'.  A "3-way switch" is a switch that's XORed with another (such as when you have 2 light switches controlling the same light fixture (and you can add a device called a '4-way switch' so that 3 light switches control one fixture)).

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 41
(732 Views)
Highlighted

I am attaching a 3 position switch through a slider. But I want the slider to be on middle position always and not down which should be 0 position and 1 I need to be the up position and 2 should be the down position. How can that be done?

0 Kudos
Message 4 of 41
(693 Views)
Highlighted
Solution
Accepted by Neha987

Hi Neha,

 

several options:

  • set a different default value
  • set the value range of the slider to -1…1, with default value=0
  • use a local variable before the loop to set the "middle" value

 

On your VI:

You can create a 2D boolean array constant, containing all the bits for your 3 indicators. Use the value from your slider to index a row from your array. This way you don't need a big case structure and all settings/code are always visible…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 5 of 41
(686 Views)
Highlighted

Thankyou.

 

Actually i am a little new to LABVIEW. Could you please make the changes and upload it. I am not quite getting what to do?

 

0 Kudos
Message 6 of 41
(673 Views)
Highlighted

Hi Neha,

 


@Neha987 wrote:

Actually i am a little new to LABVIEW.


Did you notice this "Training resources" section in the header of the LabVIEW board?

 


Could you please make the changes and upload it. I am not quite getting what to do?


What exactly don't you get?

Don't you know how to set the value range of your control? (Open it's property dialog!)

Don't you know how to set a default value? (See the context (aka: right-click) menu of the control.)

Don't you know how to use a local variable to set a value of the control? (Notice those training resources!)

Don't you know how to use an array constant and IndexArray? (Notice those training resources!)

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 7 of 41
(670 Views)
Highlighted

Actually I know how to set the range but how to make the slider stay by default at middle position which should be 0 and above and down position should be 1 and 2 respectively?

0 Kudos
Message 8 of 41
(663 Views)
Highlighted

In the file I am attaching, the switch goes only up when it is clicked. And then it comes to middle position after clicking then it goes down on clicking. How to change it so that it goes down when it is dragged down or clicked down and goes up when dragged up or clicked up??

0 Kudos
Message 9 of 41
(657 Views)
Highlighted

I am attaching a 3 position switch here. I need the sitch to go up when dragged up or clicked up and go down when dragged down or clicked down. But it only goes up when the button is clicked. How to do that?

0 Kudos
Message 10 of 41
(659 Views)