05-21-2016 07:51 AM
Hi!
I'm new to labview, and I started practicing. I'd like to create a little program which generates a random number from 0-100, and the user can enter a number by her/his choice, then the program tells if it's equal or not. I'm almost done with it, my problem is that I run the program, it generates a number, tells if the number in the Numeric Control equals to the random number, and it stops. So if I change the number in the control, nothing happens, but if choose to run the program continuously it generates numbers every moment.
So my questions is, how do I keep the program running, while not changing the random number, so the user has the time to enter her/his own number?
Thanks in advance!
I attached my program.
Solved! Go to Solution.
05-21-2016 08:05 AM
You need to enclose the code in a while loop. Add a stop button so the user can tell the program when to stop. Also put a Wait (ms) function in the loop with about 100 to 200 ms delay so the loop is not spinning millions of times per second while waiting for the user to enter a number.
When you get more advanced with LabVIEW you will want to learn to use the event structure for programs like this.
Lynn
05-21-2016 08:12 AM
Go to the LabVIEW Forum, and look at the upper left of the Main Page. Do you see this?
Click on "Learn LabVIEW Basics", and watch the first few videos -- it should teach you a lot and allow you to answer your own question (the best way to learn is by "doing it yourself").
Bob Schor
05-22-2016 02:11 AM
Thank you both!