09-23-2015 04:40 PM
I am trying to get the code to run after it has completed the movie at the end and display the results on a contour map. The problem is I cant get it to end. It restarts the movie after reaching 4000ms. Should I change the last while loop to a for loop?
Solved! Go to Solution.
09-23-2015 04:46 PM - edited 09-23-2015 04:52 PM
Reggie, my man, your code is off-the-charts linear and unscaleable. Maybe you're okay with this, though.
Your last While loop will not stop until you press the Stop button. If you want it to stop once the In Range check shows False, you can add an Or operator in there (with a Not operator too probably) to get your loop to stop.
And what's up with your first While loop? You have an Elapsed Time VI that stops the loop, but you use it by checking if Time Target is less than Elapsed Time. Why not just output the Time Has Elapsed boolean for this? You also have the default value set to 1000 seconds, which is a long time... I hope you didn't mean 1000ms.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-23-2015 04:52 PM
Yes when I press the stop button though the whole program stops which is not what I want. I need it to move along to the contour map part. Should I put the contour map inside the while loop also.
09-23-2015 04:58 PM - edited 09-23-2015 04:58 PM
See the snippet I put above to make it stop automatically at 4000. You can even remove the Stop button if you don't need it.
As you have the contour VI, it just plots the y-size and x-size in the form of an array of the same size as the loop iterations. Is this what you want? You don't want to put it inside the loop because then you would only be plotting single points over and over.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-23-2015 05:21 PM
This is what I want I am working on getting data for the z-axis. This is what i have so far. Thank you for the step above
09-23-2015 05:39 PM
No problem. Thanks are best given in the form of Kudos and Marked Solutions (Unofficial Forum Rules and Guidelines). Marked Solutions help others find this post when they have the same issue and Kudos motivate us all to keep coming back to help!
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-23-2015 05:58 PM
You should probably mark the first post above where I put the snippet as the solution.
As far as your general LabVIEW code, you could probably benefit from a little bit of training in best practices. It looks like you have a good start and grasp of how LabVIEW can be used. The state machine architecture would keep you from having such a long stretch of code like you have. Also, the use of subVIs might help.
The Simple State Machine template that ships with LabVIEW is really the best way for new developers to get familiar with LabVIEW while utilizing a semi-scalable architecture.
Here's a broad example of how a state machine works:
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'