View Single Post
  #6   Spotlight this post!  
Unread 21-03-2011, 17:26
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: Bit of coding help

Quote:
Originally Posted by Egg 3141592654 View Post
Timer.delay for wpilibj is in milliseconds, so 1 second would be
Code:
Timer.delay(1000);
The javadoc only says this:

Quote:
delay

public static void delay(double seconds)
Pause the thread for a specified time. Pause the execution of the thread for a specified period of time given in seconds. Motors will continue to run at their last assigned values, and sensors will continue to update. Only the task containing the wait will pause until the wait time is expired.
Parameters:
seconds - Length of time to pause
Note; "seconds". I'm pretty sure it's just in normal seconds. So one second would be

Code:
Timer.delay(1.0); // only accepts doubles as an argument
My team has had no problems using this, as opposed to using milliseconds(?).


However, when using other functions in the Timer class, like get(), it will return in microseconds. For our minibot deployment, we start a timer and have a condition timer.get()/1000000 > 110, if true it will deploy. If false, it'll let the user know you can't deploy yet.
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye

Last edited by Robby Unruh : 21-03-2011 at 17:30.
Reply With Quote