# pinMode()

Sets the DIO (general-purpose digital IO) pin.

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

This function allows you to change the state of DIO0..19 and the pins DO0,1. The setting contents are described in the enumeration value of `E_PIN_MODE`, [description of DIO](broken://pages/-LwHw2ptOl3clGFYr-uD) and [Description of DO](broken://pages/-LwHw2ptOl3clGFYr-uD).

{% hint style="danger" %}
DO0,1 are special pins, which in principle are used for other purposes, but can also be configured as outputs. However, these pins have hardware restrictions, so care must be taken when using them.

Both pins must be guaranteed to be at a HIGH level when power is applied. If the circuit is configured to take unstable voltages, the module will not start up.
{% 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/latest_en/api-reference/funcs/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.
