Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Read value from slider when mousebutton is released

Hi
 
I have got a stepmotor with an encoder to which i send a string command with VISA write through the COM port. The string I send is an integer value that I read from a slider from e.g. 10-30. The problem is that LabView sends the command right away I start moving the slider, but I want LabView to send the value first when I release my mousebutton on the given number on the slider, is this possible to do?
 
If LabView sends the command too fast I cannot be sure that the motor will receive the latest command, and therefore it will stop in the wrong position.
 
Simon
LabVIEW 8.6 / 2009 / 2010
Vision Development Module 8.6 / 2009 / 2010
VBAI 3.6 / 2010
0 Kudos
Message 1 of 7
(3,831 Views)
Hello,

Are you using an Event structure to detect the value change on the slider and then send the command with the new value to the motor ?
I guess yes... On string controls there is an option that you can enable or disable "update while typing", I wish we could have the same option on sliders "update while dragging" that we could enable or disable.
As far as I know it does not exist in LV 8.20, maybe it does in LV 8.50. Otherwise, it can certainly be done with an Xcontrol, but I'n not really familiar with these.

Good luck and happy wiring new year 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 7
(3,828 Views)
Instead of using the Value Change event, you should use the Mouse Up event.  When that event occurs just read to current value of the slider.
Randall Pursley
0 Kudos
Message 3 of 7
(3,822 Views)
I thought of that too but it's a bit anoying because if the pointer of the mouse in not over the slider when you release the mouse button then the event is not detected even if your value has changed.
It might be better to set the event structure to detect any mouse up event and then send a command to the motor only if the slider's value has changed since it was last sent to the motor.

hope this helps

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 7
(3,817 Views)


That might be the easiest.  It could get fairly complicated otherwise.



Message Edited by rpursley8 on 01-09-2008 08:09 PM
Randall Pursley
0 Kudos
Message 5 of 7
(3,781 Views)
Hello,

Here is a bit of code that kind of meets the requirements, I don't really like it because I think it's too much code for such a basic feature, but at least it works...

Hope it can help someone until LabVIEW team add the possibility to disable the update slider value while dragging Smiley Wink

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 7
(3,706 Views)
I keep thinking something better can be done but here is a better implementation (still not perfect because using a local) I received from NI support.

😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 7
(3,692 Views)