LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two sliders move at the same time under a certain condition

Solved!
Go to solution

I'm trying to move two sliders at the same time under a given conditions. I have my program set up as followed:

 

When 1st switch is set to "Continous", all values output 4.

When 1st switch is set to "Pulse", values output based on '"Send Signal" button press based on the following conditions below:

 

1. Slider 1 outputs the value of slider 1 and slider 2 when the switch is set to "Simultaneous".

2. Slider 1 and slider 2 output the value of slider 1 and slider 2 when set to "Independent".

 

My question is based on 1 above. I basically am having a hard time trying to figure out when the condition is set to "Simultaneous" be able see slider 2 move.

 

Can someone help? Much would be appreciated.

 

NOTE: The output is correct how I want it. I just want the slider 2 to move when slider 1 moves under a certain condition.

0 Kudos
Message 1 of 8
(5,114 Views)

if you just want to match values, then set the value of Slider 2 using a local variable.

 

See below, where I also simplified your code quite a bit. You boolean input to the selector will always be True in that case, so just wire the True case. Also, why do you multiply by zero all over the place?

 

Sliders.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 8
(5,104 Views)

Thanks for the reply James.Morris!

 

The only problem with it was it looked like the value that slider was giving me the output value on the slider. I would like the slider 2 to match slider 1 in that particular case.

 

I also may need to adjust my code to see if that does fix it. It was just from the first look it did not work. I had originally tried a property node, but the output was showing on the slider, rather than the input.  Maybe I need to make slider 2 and output in that case.

0 Kudos
Message 3 of 8
(5,092 Views)

I also multiplied by zero all over the place to make the value only show when the button was pressed.

0 Kudos
Message 4 of 8
(5,090 Views)
Solution
Accepted by topic author dmrich227

All I needed was to move the Slider 2 property node to before the the multiplcation piece.

 

Thanks again James.Morris for your help!!

0 Kudos
Message 5 of 8
(5,076 Views)

Ah yes, you can't write a value to a control to match after you've altered the original value. Duh, I should have caught that.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 6 of 8
(5,056 Views)

Yeah, All I needed to do was to move the multiplication to after the slider2 property node, and that fixed the issue. I just had to add to the multiplication piece to the false case as well.

 

I have attached the edit to the post if you wanted to see.

0 Kudos
Message 7 of 8
(5,054 Views)
Solution
Accepted by topic author dmrich227

Be careful with code duplication. If you are always going to multiply no matter the case, put the multiplication outside of the case structure. If you are going to have a Wait for the whole loop, put the Wait function outside of all the case structures (this is the correct way to do loop timing).

 

These are just general pointers so you don't run in to trouble down the line. Sounds like your application works as you expect, so have fun!

Sliders.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 8 of 8
(5,048 Views)