Sign in to follow this  
fory

How to set integer with knob?

Recommended Posts

Hello,

I want to set an integer value N at 1, 2, 3 ,..10 as a number of measurements, with a Knob. /Device=LabJackU3/

But in most cases it gives something around integer, for example: 1.8, 2.1, 4.2, 5.9 etc...

And the sequence:

while(N>0)

beginexport(Data)

delay(1)

N=N-1

endwhile

produces a different number of measurements, depending on where the Knob indicator is

Share this post


Link to post
Share on other sites

I'm assuming you have the precision of the knob set at 0 so only an integer displays. If so, the display is going to be the value rounded, so you just need to round the value in your code:

private x = floor(n+0.5)
while (x>0)
   beginexport(data)
   delay(1)
   x--
endwhile

Share this post


Link to post
Share on other sites

Thank you for your suggestion! It works! And I also think it would be god if the pointer of Knob switches only between integer numbers and there are no medial values, but it seems that it is imposible ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this