timers
The NXT has three built-in timers that act like stopwatches. You can use a timer to tell you how long your program has been running or to measure how long it takes the robot to perform a particular task. Typically using a timer is a two-step process: You reset the timer to 0 before beginning a task, and then read the timer when the task is complete. Think of a timer as a kind of sensor for time.
Like a stopwatch, a timer can be used for a variety of purposes. For example, you can do any of the following:
Time how long it takes your entire program to run and use that information to fine-tune parts of your program. For example, you might measure how long it takes your robot to solve a maze and then use that information to find the fastest solution. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access