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

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

0 Kudos
Message 1 of 41
(3,659 Views)

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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 41
(3,650 Views)

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
(3,579 Views)

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
(3,540 Views)
Solution
Accepted by topic author 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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 41
(3,533 Views)

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
(3,520 Views)

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 LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 41
(3,517 Views)

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
(3,510 Views)

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
(3,504 Views)

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
(3,506 Views)