> For the complete documentation index, see [llms.txt](https://mwx.twelite.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mwx.twelite.info/latest1/api-reference/predefined_objs/ticktimer.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://mwx.twelite.info/latest1/api-reference/predefined_objs/ticktimer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
