ElapsedTime Setup
Last updated
Last updated
Before getting started, let's quickly identify where we will find our ElapsedTime blocks. This menu can be found under the Utilities dropdown on our side toolbar.
For this section, let's start by creating a new OpMode named HelloRobot_ElapsedTime using the BasicOpMode sample.
Recall when we created variables while programming our drivetrain. We will be using them again during this part to help with calculations! To start create a variable called runtime.
From the variable menu, add the block to the OpMode below the comment block.
In order to utilize elements of the ElapsedTime, runtime will act as the ElapsedTime variable. Add the block to the block.
Before moving on to the rest of the ElapsedTime structure lets go ahead and add the motor related blocks. Add to the op mode to the while loop.
Remember that on a drivetrain one of our motors will need to be set to run in reverse to prevent the robot from spinning in place! Add the block under the the block set.