View unanswered posts | View active topics It is currently Sat Oct 19, 2019 2:47 am






Reply to topic  [ 3 posts ] 
while with multiple conditions 
Author Message
Rookie

Joined: Mon Nov 09, 2009 10:51 am
Posts: 23
Post while with multiple conditions
I'm using the timer to specify different sets of motor commands depending on how long the timer has progressed.
This seems like it should work but nothing happens. The program ends right away. Why? I can get it to work if the two while statements are single conditions (while(time100[T1] < 100) and (while(time100[T1] > 100) but that only gives me two segments to work with and I want to mark out more sections than that.
Any ideas appreciated!
-Erik
Code:
task main()
{

  ClearTimer(T1); 

  while((time100[T1] > 0) && (time100[T1] < 100))
  //while the timer is btw 0 secs and 10 secs do the following
      {
         // one set of motor commands
       }
    while((time100[T1] > 101) && (time100[T1] < 150))
  //while the timer is btw 10 secs and 15 secs do the following
      {
         // different set of motor commands
       }
}


Mon Feb 22, 2010 7:52 pm
Profile
Expert
User avatar

Joined: Mon Oct 06, 2008 6:30 pm
Posts: 176
Location: Netherlands
Post Re: while with multiple conditions
The timer starts at 0, thus the while condition is false.

_________________
My most recent blog: A grain of sugar


Mon Feb 22, 2010 8:02 pm
Profile WWW
Rookie

Joined: Mon Nov 09, 2009 10:51 am
Posts: 23
Post Re: while with multiple conditions
Ugh, how could I miss that! Thanks.


Mon Feb 22, 2010 8:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.