Timer#
The Timer attribute can also be called without Brain as its own Class.
time()#
The time(units) method returns the elapsed time.
Parameters  | 
Description  | 
|---|---|
  | 
A valid   | 
Returns: The elapsed time in the specified units.
clear()#
The clear() method resets the timer value to 0.
Returns: None.
reset()#
The reset() method resets the timer value.
Returns: None.
system()#
The system() method returns the system time.
Returns: The system time in milliseconds.
event()#
The event(callback, delay) method registers a callback function for a timer event.
Parameters  | 
Description  | 
|---|---|
  | 
The callback function to be called when the event occurs.  | 
  | 
The delay before the callback function is called.  | 
Returns: None.
// Create a new function timer_event().
void timer_event() {
  Brain.Screen.print("timer event");
}
int main() {
  // Run timer_event() after 100 milliseconds.
  Brain.Timer.event(timer_event, 100);
}