I'm trying to get the timer to work properly with WebbotLib and having a few probs.
First, this code:
TICK_COUNT start = clockGetus();
do_something();
for(i=0;i<10;i++)
{
do_stuff();
TICK_COUNT end = clockGetus();
TICK_COUNT duration = end - start;
rprintf("%d",duration);
TICK_COUNT start = clockGetus();//restart clock
}
gives me this warning:
../code.h:287: warning: unused variable 'start'
Line 287 is referring to the 'start' in the for loop. The position of it doesn't seem to matter.
Next, I think a clockGetms(); function could be useful (for ms, not us).
Also, what is the best way to print out the timer? I tried this:
rprintf("%d",duration);
But it only prints the timer as a signed long int - meaning it is giving me values from +/-32768 (and overflowing way too fast for what I'm measuring).
Then I tried this:
rprintfu16(duration);
But it just gives me strange values like 'B5C0'.
I also tried:
rprintf("%ld",duration);
but it just does:
ldldldldldldldldld