Bool timer

#1

so in ROBOTC, a bool timer is written like this:

bool timerBool = true;

clearTimer(T1);

and so on…

How would this be written in VCS?

0 Likes

#2

What does that bool do?

In general, you read the current time, save it to a variable and then later read the current time and subtract start time. That gets elapsed time.

0 Likes

#3

That T1 timer thing is something provided by robotC.
There is documentation and examples for it.
However, in your example the bool does nothing.
In VCS, you have to do as tabor says and do the math to find duration between two timepoints.
There should be a way to get current time in VCS.

0 Likes

#4
  vex::timer t1;

  t1.clear();
  int32_t x = t1.time();

and so on.

2 Likes