# TickTimer

TickTimerはTWENETの内部制御用に利用され、暗黙に実行されています。タイマーの周期は1msです。`loop()`中でTickTimerイベントにより1msごとの処理を記述する目的で`available()`メソッドのみを定義しています。

{% hint style="warning" %}
必ず1ms刻みでavailableになる訳ではない点に注意してください。

ユーザプログラムの記述内容や、システム内部の割り込み処理などが要因で、大きな遅延が発生することもあり、イベントが飛ばされるような場合もあります。

```cpp
void loop() {
  if (TickTimer.available()) {
    if ((millis() & 0x3FF) == 0) { // これは処理されない場合がある
      Serial << '*';
    }
  }
}
```

{% endhint %}

## メソッド

available()

```cpp
inline bool available()
```

TickTimer割り込み発生後にセットされ、その直後の`loop()`で`true`になります。`loop()`終了後にクリアされます。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mwx.twelite.info/v0.1.9/api-reference/predefined_objs/ticktimer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
