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

Link to comment
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

Link to comment
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 ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.