04-04-2017 03:09 PM
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.
Solved! Go to Solution.
04-04-2017 03:32 PM
Put the code inside the while loop into an event structure in a value change event for the slider.
04-04-2017 03:39 PM
You can also add a small 10ms delay in your code to slow down the execution.
04-04-2017 03:52 PM - edited 04-04-2017 03:52 PM
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.
04-04-2017 03:52 PM
Hi Aputamen,
I've never used Event Structures, and the LabVIEW help isn't being terribly helpful... Do you mind showing me?
Thanks
04-04-2017 04:11 PM
Sorry, 20 minutes of futzing and I found it. Thanks!
04-04-2017 04:52 PM
"Futzing around" is the best way to learn, IMHO.
04-04-2017 05:01 PM
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. 😄
04-04-2017 05:10 PM
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!
04-05-2017 10:49 AM
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!