# what Timer value = 1 second?

Hey guys I am trying to program an autonomous and I would like to use a timer for something but I don’t know what the Timers value =. Could some please tell me the value of the Timers at 1 second? That way when I’m programming I can say “If ( Timer1 == ‘Timer Value which = 1s’ * 2 )” That way it would be 2 seconds.

Thanks

In ROBOTC (and I’m pretty sure in easyC), timers measure time in milliseconds. Therefore, the timer would be at 1000 counts once it reached 1 second.

~Jordan

It is the same way in EasyC. So yeah, 1000 really means 1 second.

Ok thanks guys!

You’re welcome!

~Jordan

Oh and before I forget I have one more question. In programming what does “While ( ! IsEnabled () )” mean?

Three C operations are stacked:

-While is a loop that executes as long as (while) the stuff in the parentheses returns non-zero (not false).

-! is a logical NOT - it returns the opposite of the input - In C, false = 0 and true = not 0, so a 1 would become a 0 and a 0 would become a 1

-IsEnabled() is calling a function (Called IsEnabled) which returns an unsigned char of the enabled state.

The whole series of instructions causes the loop after the while to execute infinitely until the robot is enabled (as soon as IsEnabled() returns 1, the loop will end)

The purpose is to execute stuff before entering Teleop, multiple times. There are better ways to do this using RepeatingTimers, but it’s a rudimentary method that works.

Well I knew what a while loop is and I also knew what ! meant. I just needed to know what it does.

Just to make sure I understand, inserting a While ( ! IsEnabled () ) loop into your say Initialize function would make that function run until the robots are set to autonomous mode by the Competition software?