View Single Post
  #4   Spotlight this post!  
Unread 11-12-2015, 15:35
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,715
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Command based code secan

Quote:
Originally Posted by cpapplefamily View Post
I understand enough that long loops would be bad in this environment. Do I use waits and loops in the execute method? Then use the isFinished() command or a condition of the loop to end the code. What happens the loop was running still when the execute method is called again and again. Or do I record the time since last execute to calculate my time sensitive code? most of the documentation I read is is the execute and isFinished is called "ABOUT" 50 times / sec or every 20ms.

This is not what I'm aiming for but simply put every 1 sec i want to add 10 to double myCounter

Code:
double myCounter = 0;

while(true){

   myCounter = myCounter + 10;
   wait(1000); //Wait 1 sec

}
You would not want to put any loops or waits in the execute method and instead check the time there to see if you should add 10 to the counter.
Reply With Quote