Go to Post I find it quite amazing that this thread has been continuously active for more than two years. - Stephanie [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 14-02-2009, 18:47
cvxdes cvxdes is offline
Registered User
FRC #0061
 
Join Date: Feb 2009
Location: Milford MA
Posts: 7
cvxdes is an unknown quantity at this point
Storing a variable outside of a loop

We're trying to work on our acceleration algorithm. At first we were going to go with the accelerometer, but the thing is actually a lot more unpredictable than we thought, so we now want to use just a straight line for acceleration, something like y=mx+b. Only problem is, we can't seem to figure out how to store the previous y, since y will become b the next time around the loop. I know how to do this in php, but I have NO idea about LabVIEW.

Since what I just said could be kinda confusing, here's how I would have coded it if robots could run php:
PHP Code:
<?
$override 
false// This would become true if the pilot presses a button, for taking turns or suddenly going in reverse to brake. 
$current_speed 0;
$wants_to_go 1;
$acceleration 0.05;
while(
true){
    if(!
$override){
        while(
$current_speed <= $wants_to_go){
            
$current_speed $current_speed $acceleration;
        }
    }else{
        
$current_speed $wants_to_go;
    }
}
?>
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing functions to variables Tz0m Programming 8 18-02-2007 11:36
Storing the balls Max Brin Technical Discussion 4 18-02-2006 20:34
Storing Tetras on Robot MisterX General Forum 22 15-01-2005 19:26
SCORing vs. STORing Chris Fultz General Forum 3 15-01-2004 13:36


All times are GMT -5. The time now is 10:41.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi