# pinMode()

DIO(汎用ディジタルIO)ピンの設定を行います。

```cpp
void pinMode(uint8_t u8pin, E_PIN_MODE mode)
```

この関数では DIO0..19 と、DO0,1のピンの状態を変更できます。設定内容は `E_PIN_MODE` の列挙値の[DIOの解説](/v0.1.7/api-reference/functions-1/dio.md#pinnomdodio-0-19)と[DOの解説](/v0.1.7/api-reference/functions-1/dio.md#pinnomdodo-0-1)を参照してください。

{% hint style="danger" %}
DO0,1は特殊なピンで、原則として他の目的で利用されるものですが、出力としても設定可能です。ただしハード的な制約があるピンですので、利用には注意が必要です。

両方のピンは、電源投入時にHIGHレベルが担保される必要があります。不安定な電圧をとったりするような回路構成の場合、モジュールが起動しないなどの問題が出ます。
{% endhint %}


---

# 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.7/api-reference/functions-1/dio/pinmode.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.
