LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Locking one slide position based off another

Solved!
Go to solution

I'm trying to make a slider with two position markers (A & B).  At certain times I want A & B to be completely independent of each other, but at others I want slider B to be controlled by slider A.  For example, when I want them locked together I want B = A + 2.  I know how to get the value of sliders A & B from a property node, but I can't figure out how to set one without setting the other an/or freezing. Any ideas? Attached is a VI snippet and the VI itself.   Thanks. 

Download All
0 Kudos
Message 1 of 12
(4,025 Views)
Solution
Accepted by topic author athiggins

Put the code inside the while loop into an event structure in a value change event for the slider.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 12
(3,996 Views)

You can also add a small 10ms delay in your code to slow down the execution. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 12
(3,993 Views)
  • You are not getting any values from a property node, you are setting values.
  • A local variable here would be much better than a value property node
  • If they are locked, you should be able to move either A or B.
  • Your set control should be I32, not DBL if the rest is all I32.

 

Yes, create an event structure for slide value changed, see which one changed, and update accordingly. There is no reason to spin the loop millions of time/second if nothing changes.

0 Kudos
Message 4 of 12
(3,982 Views)

Hi Aputamen,

 

I've never used Event Structures, and the LabVIEW help isn't being terribly helpful... Do you mind showing me?

 

Thanks

 

 

0 Kudos
Message 5 of 12
(3,977 Views)

Sorry, 20 minutes of futzing and I found it.  Thanks!

0 Kudos
Message 6 of 12
(3,968 Views)

"Futzing around" is the best way to learn, IMHO.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 12
(3,954 Views)

There are a couple of things that you should keep in mind. For example, make sure to limit the even queue size to one and don't forget an event for the stop button. Also use a local variable instead of a value property, use the correct representations, etc.

 

Feel free to attach your code for a second look. 😄

0 Kudos
Message 8 of 12
(3,952 Views)

That would be great!  The slider changing bit is part of a larger code for a vitals monitor.  I'll polish the code, gather some sample data, and send it your way tomorrow when I'm back at work.  Thanks!

0 Kudos
Message 9 of 12
(3,950 Views)

 

Here is the larger code the slider bit was shoved into.  The slider can be found in the "Analysis" mode.

 

To test the acquisition mode, be sure to select the "Simulate?" option on the top, else you will get an error saying the DAQ box isn't connected.  

 

Attached is the VI and some test data for your perusal.  Please feel free to critique my work.  Any suggests will be appreciated.  Thanks!

Download All
0 Kudos
Message 10 of 12
(3,778 Views)