📙
MyBotSDK
  • Introduction
  • Start Moving
    • setPower()
    • goToPoint()
    • setGoToPointPIDCoeff()
  • Debugging
  • Utilizing Time in your code
  • Utilizing Sensor Input
  • Other Useful Classes
  • Using Gradle Scripts
  • Track Width and Aux Width
  • Contact
  • Community
  • Robot.RangeClip
  • No Wifi card?
Powered by GitBook
On this page
  • ElapsedTime()
  • Instructions for use:

Was this helpful?

Utilizing Time in your code

ElapsedTime()

ElapsedTime is a class that can easily get you the amount of time that has passed since you pressed init() and to the current time step.

Instructions for use:

  1. First create the variable at the top of your code.

ElapsedTime mStateTime;

2. Then create assign it to a new instance of the class.

//Inside Init
mStateTime = new ElapsedTime();

3. Then make sure that it starts when you click the start button

public override void onStart()
{
    mStateTime.startTime();
}

4. Then use it inside your loop using these methods:

  • timeMilliseconds()

  • timeSeconds()

  • timeMinutes()

For Example:

telemetry.addData("Time", mStateTime.timeSeconds().ToString());

PreviousDebuggingNextUtilizing Sensor Input

Last updated 5 years ago

Was this helpful?