LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a slider to automatically sweep through a bunch of values

Hi there,

 

I've never used LabVIEW before in my life so I'm completely stuck on what to do.

I have a camera and a filter. I've created an interface where you use a slider to select a wavelength between 400nm and 720nm on the filter and hence it changes the image seen through the camera's display. I've managed to get the slider working so that you can vary the wavelength by sliding the slider arrow.

 

I firstly want to have an input box where you can manually type in the wavelength that you want which will automatically set that slider arrow to your input wavelength value. I've hazard a guess that you'd need to use a numeric control input box where you can type or select the wavelength, but I have no idea how to get it to talk to the slider to automatically change the slider arrow position.

 

Additionally, I want a button that on clicking will slide the slider up in 1nm increments, i.e 400nm, 401, 402 etc up to 720nm over a time period that can be chosen using another input box.

Can someone please point me in the right direction?

Thanks in advance.

0 Kudos
Message 1 of 4
(2,359 Views)

Hi Fairbz,

 

place a slider control on your frontpanel.

Then right-click the slider and select "visible objects -> digital display": now you can input either by numeric value or by moving the slider handle…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,355 Views)

@Fairbz wrote:

Hi there,

 Additionally, I want a button that on clicking will slide the slider up in 1nm increments, i.e 400nm, 401, 402 etc up to 720nm over a time period that can be chosen using another input box.

Can someone please point me in the right direction?

Thanks in advance.


Gerd has already told you how to get the digital display, you just need to show it. For your other question, it is actually not related to the slider at all. What I mean is, the code to do what you want to do would look almost identical whether the slider exists as a display or not.

 

First some general tips. LabVIEW has a very low barrier of entry. Engineers who have never programmed in their life can start reading from an instrument in an hour or two. However, you will benefit a ton from going through some of the training on the front page of the forums. Have you heard of the 80/20 rule? For LabVIEW it might be more like 70/30, but the idea is that you will get 80% of the way there from spending 20% of the time. 

 

If you are familiar with other programming languages, you will instantly recognize the type of loop you need when you have a start, stop, and index step. (For Loop) In LabVIEW, you press Ctrl+Space to bring of quick drop. Type in "for loop", press enter, and now the loop is on the tip of your mouse. Just drag it at the size you want on your block diagram. Another useful function is "Ramp Pattern.vi" to generate the array of values you need. If you wire an array into a for loop it automatically knows how many times to run based on the length of the array. You can disable this by right clicking on the terminal and disabling indexing. You can also use the "Wait (ms)" function to ensure your code takes a minimum amount of time to execute. 

 

I encourage you to play with some of the elements and give it your best shot, then come back and post your code and where you are stuck.

Capture.PNG

 

0 Kudos
Message 3 of 4
(2,320 Views)

@Fairbz wrote:

 

I've never used LabVIEW before in my life so I'm completely stuck on what to do.


Well if you haven't found free training here are some:

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction (Alternate Google Drive)

6 Hour LabVIEW Introduction (Google Drive)
Self Paced training for students
Self Paced training beginner to advanced, SSP Required

 

The self paced training is my favorite.  MyRIO has lots of great documentation on hooking up various sensors too but that likely is a bit advanced for you.  I've been doing LabVIEW for 14 years almost daily and I'm still learning new stuff, so take your time.

0 Kudos
Message 4 of 4
(2,319 Views)