计时器#
The Timer attribute can also be called without Brain as its own Class.
时间()#
The time(units) method returns the elapsed time.
参数 |
描述 |
|---|---|
|
A valid |
**返回:**指定单位的经过时间。
清除()#
The clear() method resets the timer value to 0.
**返回:**无。
重置()#
The reset() method resets the timer value.
**返回:**无。
系统()#
The system() method returns the system time.
返回: 以毫秒为单位的系统时间。
系统高分辨率()#
The systemHighRes() method returns the high-resolution system time.
**返回:**以毫秒为单位的高分辨率系统时间。
事件()#
The event(callback, delay) method registers a callback function for a timer event.
参数 |
描述 |
|---|---|
|
事件发生时调用的回调函数。 |
|
回调函数被调用之前的延迟。 |
**返回:**无。
// Create a new function timerEvent().
void timerEvent() {
Brain.Screen.print("timer event");
}
int main() {
// Run timerEvent() after 100 milliseconds.
Brain.Timer.event(timerEvent, 100);
}