Lesson 7.2 – Timers

Lesson Attachments

V5 Timer

There is an internal timer in your V5 brain that is always running.  You can use this to control time-based or time-dependent behaviors.

Example

Lines 67-69 creates 3 float variables we will use to record and calculate elapsed time.
Line 72 resets the internal timer to 0 since it begins counting the instant the program starts.
Line 73 dumps the current value of the timer into the timeStart variable.
Line 74 represents any action that takes time to execute.
Line 75 dumps the current value of the timer into the timeEnd variable.
Line 76 calculates the time elapsed and dumps it into the totalTime variable.
Line 77 prints the value of totalTime.