Thread: Wait() issue
View Single Post
  #1   Spotlight this post!  
Unread 12-02-2013, 11:37
mrklempae mrklempae is offline
Registered User
no team
 
Join Date: Jan 2013
Location: Montana
Posts: 19
mrklempae is an unknown quantity at this point
Wait() issue

We're having trouble with out robot losing control every time Wait() is used. We need to delay part of our code from executing for 1/10th or 1/100th second. That part works (we can't notice the delay), but in other parts of the code (where we need 1.5 second delay) we completely lose control for that period of time. Someone mentioned that we could use the Timer() class for this, but we weren't sure how accurate it is, having to Start and Stop it in a very short period of time. Here's part of out code that causes the most issues:
Code:
			if ((LeftBumper)&&(RightBumper))  //xBox controller
			{
				front->Set(-speed); //Talons
				back-> Set(speed);
				if (ButtonA)
				{
					Forward->Set(1); //solenoids
					Reverse->Set(0);
					Wait(0.1);
					Forward->Set(0);
					Reverse->Set(1);
					Wait(1.5);
				}
			}
Has anyone else encountered this problem?
Reply With Quote